Writing shell script to deploy changed file via ftp

When you work with a cheap host, you just have FTP account to push your file to host. It will be terrible if you have to pull all changed file to host via FTP. Because you must answer many stupid question as “what files I was change?”, “Where files I was change?”, “What is ftp account?” …

0284ed8e-26be-11e4-a4aa-12313d044945-medium

So I think that it is better if you write a script to handle all task and help you answer all question. The way is posted the below will run well in linux environment.

Firstly, we need a script to upload file via FTP.  The script below requires CURL. You just need to change value of REMOTE_HOST, REMOTE_USER, REMOTE_PASSWD. It will work well.

After that, you write a script to list all file that needs to push to your FTP host. That script is similar to the script below.

With the script above, you need to provide 2 tag name, and script will check all file changes between them.  Finally, It calls fpt.sh script to push that files to FTP host.

You can see full source code in my Github: https://github.com/thanhson1085/git2ftp