Thursday, May 27, 2010

anacrontab entry for nonroot

found a good way to run an anachron job as a non-root user. here's an example line from /etc/anacrontab
1 23 py_anacron nice su --command="/bin/bash -i -c 'python ~/svn/Python/script.py'" username
this will run the script every day (as long as the computer is on at some point that day, unlike cron which will only work if the computer is on at the right time) after a 23 minute delay, with the user's full login environment. the /var/spool/anacron/py_anacron file will show the date it was last run.

No comments: