Here's what I have in my crontab:
* * * * * /bin/bash /home/user_name/script.sh
Here's what's in the file:
#!/bin/bash
cd /var/www/sites/site1
sudo svn update *
cd /var/www/sites/site2
sudo svn update *
The script is set to +x.
Any ideas on why it won't run in cron? It runs fine when I run it manually.
Answer
Any reason you have /bin/bash in cron invocation? The #!/bin/bash in the script itself should do the same thing. Also make sure that the script is configured to executable (chmod +x/chmod 755). Verify that you want to run the program under your account, otherwise specify the user with the sudo -u "USERNAME"
command. Also check and make sure that your account (or the account you want it to run under) has the NOPASSWD option added in /etc/sudoers (more info here:http://www.gratisoft.us/sudo/sudoers.man.html).
No comments:
Post a Comment