Automatically update programs on the server through Cron

Source: Internet
Author: User
Tags svn update
A program code for a website is deployed on a Linux server and is sent to the website directory under htdocs through SVN checkout.
To automatically update code changes, write a shell script svn_update.sh and add it to cron to update the website code every 5 minutes.
The [svn_update.sh] file is as follows:
/Usr/bin/SVN update -- username myusername -- password mypass/usr/local/Apache/htdocs/mysite
And modify cron through crontab-E:
*/5 */usr/local/Apache/htdocs/mysite/svn_update.sh &
Result: cron runs automatically and runs the svn_update.sh script every five minutes (you can view the running logs of cron through tail-F/var/log/cron ),
However, the strange thing is that the program code under mysite has been updated. directly execute svn_update.sh on the shell command line to update the website program file.
Solution: I started to think it was a permission issue. But after that, I set svn_update.sh/usr/bin/SVN to 777 permissions, but I still cannot do it. After several twists and turns, I finally found a solution,
Add the first line in svn_update.sh
./Etc/profile
.~ /. Bash_profile
Two lines of commands are complete.
This shows the problem of making environment variables. Haha ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.