Since SSH can execute remote command, the FTP software is also gradually less used.
Every time the server code is updated, all want to pack, upload, login to the server to modify file permissions, update Cache, and so on, slow and error prone, so make a script, a help me to fix, I lit a cigarette sitting in front of the computer, or play a while "Plant vs Zombies" what, leisurely!
Ps:ant and phing users, you can ignore ... I just like to play Shell.
Copy Code code as follows:
#!/bin/sh
Home= '/cygdrive/d/public_html/myproject '
# # Pack The local code first
# # Exclude the following files: *.svn, *.bat, upload.sh, cache
# # If you need to exclude a lot of files, you can use the parameters--exclude-from=file
# # Writes a line of files to file
CD $HOME
Tar jcf tmp.tar.bz2 * \
--exclude=*.bat \
--EXCLUDE=*.BZ2 \
--exclude=*.gz \
--EXCLUDE=.SVN \
--exclude=cache \
--exclude=upload.sh \
# # upload files via SCP
SCP tmp.tar.bz2 user@your.host.com:/home/public_html/myproject/tmp.tar.bz2
# # Execute remote SSH command
# # Here's another script executed load.sh
SSH user@your.host.com
"
Cd/home/public_html/myproject
Tar jxf tmp.tar.bz2
Chown-r Web:web *
Chmod-r 755 *
SH load.sh
Rm-f tmp.tar.bz2
"
# # Delete local files
Rm-f tmp.tar.bz2
echo "Everything is done."
# Week one by one month by Verdana
# Vim:set Expandtab tabstop=4 shiftwidth=4:
SSH I configured the automatic login, you can refer to here.