Purpose of project
Send ftp files and to a remote ftp server and resend them in case of connection faillure .
Design Architecture
![design achitecture](http://gitlab.sanlien.com.tw/jean/ftpscripts/raw/master/img/script.png)
Note
ftp.sh
is only sending the files modified in less than one hour .
Manual Usage
-
Install FTP server on the Raspberry pi by running the command $ sudo apt-get update
then $ sudo apt-get install ftp
-
Move the ftp.sh
file to /home/pi/Desktop/vAlert/bin
-
Move the ResendFtpFiles.sh
to the same folder as above
-
Navigate to /home/pi/Desktop/vAlert/log
-
Create a new file named /TobeUploadedList.txt
-
Make sure that TobeUploadedList.txt
is writable by running $ chmod 777 TobeUploadedList.txt
-
Open a terminal (Mac Terminal , putty, Git Bash)
-
Type $ ssh pi@<pi_ip_address>
-
Login and Navigate to /home/pi/Desktop/vAlert/rec
-
Edit a ramdom file
-
Navigate to /home/pi/Desktop/vAlert/bin
-
Run chmod +x ftp.sh
-
Run $ ./ftp.sh
-
Check that /home/pi/Desktop/vAlert/log/TobeUploadedList.txt
has be written
-
If /home/pi/Desktop/vAlert/log/TobeUploadedList.txt
has been written Run $ chmod +x ResendFtpFiles.sh
then$ ./ResendFtpFiles.sh
Crontab schedule Usage
-
After Testing function with steps above you can schedule the scripts with Crontab to run periodically or at some specific hour of the day
-First you should createa file undert/etc
name myftpLog.log
by just running $ touch /etc/mydtpLog.log
-
Then run
$ echo "10 12 * * * /home/pi/Desktop/vAlert/bin/./ftp.sh >> /etc/myftpLog.log 2>&1" >> /etc/crontab