cloudnull/turbolift — pull request #29 by alexandru-iacob (2013-10-31 09:29:24+00:00)
Title: Create EXAMPLE folder. Add SFTP-CDN sync script

Add script for synchronizing a remote SFTP folder with a CDN container.

Work-flow:

user uploads files/folders to SFTP;
the script will sync the files/folders to the specified container;
all actions are logged;
the script will also clean log files older than 3 days (this can be easily changed according to user specification);
as well, the script can remove obsolete files from the CDN container (if the user deleted files from SFTP, this will remain on CDN until they are deleted);

Some precautions were taken as well:

the script checks for any undefined variables;
the script checks if there is another instance running (LOCKING mechanism implemented)

The script is tested and I'm using it via a CRON job.