Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr3398 :: Anacron

Put down that crontab and get started with anacron

<< First, < Previous, , Latest >>

Hosted by Klaatu on 2021-08-11 is flagged as Clean and is released under a CC-BY-SA license.
cron, linux, service, automation.
Listen in ogg, spx, or mp3 format. | Comments (0).

general.

Setup


$ mkdir -p ~/.local/etc/cron.daily ~/.var/spool/anacron

Create a file called anacrontab:


$ touch /.local/etc/anacrontab

Set it up to trigger scripts in your cron.daily folder:


SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
1  0  cron.daily   run-parts $HOME/.local/etc/cron.daily/

Validate your anacrontab:


$ anacron -T -t ~/.local/etc/anacrontab -S ~/.var/spool/anacron

Start anacron in a file that gets triggered at login, such as ~/.profile:


anacron -t $HOME/.local/etc/anacrontab -S $HOME/.var/spool/anacron

Using

Now that everything is set up, just put scripts you want to run regularly in cron.daily, and make them executable.

You can set up a weekly directory, too. Just set the time interval in your anacrontab to:


SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
7  0  cron.weekly   run-parts $HOME/.local/etc/cron.weekly/

Comments

Subscribe to the comments RSS feed.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?