Good points.  Thanks for the guidance.

Cheers


On Oct 26, 2007, at 9:50 AM, Chris Pepper wrote:

"sudo" requires an argument; to get a root shell, use "sudo -s". But sudo normally prompts for the password of the administrative user running sudo, which is going to be a problem for a shell script.

        You can run the script as root.
You can configure sudo not to require a password: "visudo" or perhaps "sudo visudo" from the command line; then add "Defaults ! authenticate" at the top of the file.

Probably better to do something like this in a shell script (which should be owned by root, not yourself, for security reasons; don't put trailing slashes on the source directories or cp will misbehave):

/usr/local/bin/backup-web.sh:

#!/bin/sh
$TODAY=date "+%Y-%m-%d"
mkdir -p ~rich/Desktop/backup/$TODAY
cp -R /usr/local/mysql /etc/httpd/httpd.conf /etc/httpd/users ~rich/ Desktop/backup/$TODAY
chown -R rich ~rich/Desktop/backup/$TODAY

Then add a cron job for root: "sudo EDITOR=bbedit crontab -e" and add an entry like this:

0       1       *       *       *       /usr/local/bin/backup-web.sh



Rich in Toronto


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to