I'm difinitely not an expert on bash files, but i know my way around, create daily backup or rsync with a cronjob, but i've NEVER used ftp or pftp on linux and frankly i'm at a lost.
I can't even work out a manual ftp connection, but my goal is to bash it.
i've got a dedicated server for youtube like experimentation and it does a backup every morning of the database and stuff (other than videos).
I rsync it on a local computer every noon but i'd like to use a low price / lot of space shared hosting like powweb to dump the daily backup, but it dont use ssh so i'll have to use FTP to do it.
I can connect like this :
Code:
pftp votreespace.net
Connected to someserver.net (75.126.XXX.XXX).
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 3 of 50 allowed.
220-Local time is now 11:41. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 80 minutes of inactivity.
Unknown .netrc keyword Johnny
Unknown .netrc keyword *********
Unknown .netrc keyword someserver.net
Name (someserver.net:root): Johnny
331 User Johnny OK. Password required
Password:
230-User Johnny has group access to: Johnny
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quit
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
i figured out how to connect... but not automaticly with the .netrc cause i can't seam to figure this out ?
i want it to autoconnect to the ftp, upload a file and disconnect within this bash file :
Code:
date=$(date +'%F')
set -- $date
mkdir /var/backups
tar -cjvf /var/BACKUPS/backup.$date.tar.bz2 --exclude /var/www/html/videos.sportsmotorises.com/uploads
--exclude /var/www/html/videos.yournetspace.ca/uploads /var/www /var/log /var/lib/mysql /etc/httpd /etc/php.ini /etc/php.d
*** connect to ftp
*** go to repertory i want
*** upload /var/BACKUPS/backup.$date.tar.bz2
*** disconnect
is that even possible ?