Sunday, 2 September 2012

FreeBSD /usr/local/etc/anacrontab or startup command



  • # pkg_add -r anacron
  • add anacron_enable="YES" to /etc/rc.conf

It wasn't easy to google an example for running Anacron so I decided to show mine.

I have got my shell script which create memory disk, mount it, create different directories for php and xcache entries.  Then change user/group rights for starting xcache. Although this is one-time job it will be running once a 30 days, first minute after system is started.

# days make sure the command is executed at least every 'days' days
# delay delay in minutes, before a command starts
# id unique id of a command

# days delay id command
# 1 5 daily periodic daily
# 7 15 weekly periodic weekly
# 30 60 monthly periodic monthly
  30 1 onetime /root/start-xcache

You can make alteration for your need.

You can see what is ready to run here:
ll -h /var/spool/anacron/
For any problems check  /var/log/messages


0 komentářů:

Post a Comment