You are not logged in.
Pages: 1
I'm a bit confused about the cronie package in Arch. Am I supposed to configure my crontab with 'crontab -e' - the traditional approach to me since I run Slackware also - or should I hack the /etc/cron.d directory? How does it work? Because a file named 0hourly is put there and I figured that it's supposed to run what's in /etc/cron.hourly (which by default has a script to call anacron).
Fundamental Axiom of the Universe (aka Murphy's Law): Whatever can go wrong, will go wrong.
First Digital Deduction: Nothing obeys Murphy's Law so well as computers.
Second Digital Deduction: Everything go wrong at least once.
Third Digital Deduction: Things go wrong even when there's absolutely no possibility of anything go wrong.
Offline
Ideally, you shouldn't put scripts in cron.d. It is meant for the packages to install their scripts there.
You should either put your scripts in cron.{hourly,daily,monthly,weekly} or use "crontab -e".
Offline
You should either put your scripts in cron.{hourly,daily,monthly,weekly} or use "crontab -e".
Isn't this 'or' an 'and'? Can I just put system-wide scripts there and not run 'crontab -e' as root?
Fundamental Axiom of the Universe (aka Murphy's Law): Whatever can go wrong, will go wrong.
First Digital Deduction: Nothing obeys Murphy's Law so well as computers.
Second Digital Deduction: Everything go wrong at least once.
Third Digital Deduction: Things go wrong even when there's absolutely no possibility of anything go wrong.
Offline
I am not sure about the contents of cronie's root crontab.
But with dcron, you can just drop the scripts inside the directories I mentioned and they are run accordingly and no change is required with crontab -e.
Here's the contents of my dcron root crontab:
@hourly ID=sys-hourly /usr/bin/run-cron /etc/cron.hourly
@daily ID=sys-daily /usr/bin/run-cron /etc/cron.daily
@weekly ID=sys-weekly /usr/bin/run-cron /etc/cron.weekly
@monthly ID=sys-monthly /usr/bin/run-cron /etc/cron.monthly
I believe that cronie's should be similar.
Offline
Cronie separates the anacron functionality from the root crontab. So this is the /etc/anacrontab:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
@Imello, for your user, you should be using "crontab -e" and for root you should also use "crontab -e". If you want to use anacron at in interval that fits within the existing setup (that is, daily/weekly/monthly) then you should use the /etc/cron.{daily,weekly,monthly}. As I understand it, the difference between cron and anacron is that cron will run something at the specified intervals if the machine is on, while anacron will check to see if the given interval has been run at the appropriate time. If it has been missed, it will run it.
So you should definitely be using "crontab -e" or /etc/cron.{daily,weekly,monthly}.
With the /etc/cron.hourly directory, you could use that, but it is actually just run as an hourly regular cronjob, not by anacron like the others. I presume this is because it is a regular enough interval that it will likely be run fairly consistently.
Offline
@Imello, for your user, you should be using "crontab -e" and for root you should also use "crontab -e".
So you should definitely be using "crontab -e" or /etc/cron.{daily,weekly,monthly}.
Thanks, I think I get it: can I put my scripts on these folders and use 'crontab -e' for like @x33a's just 'to make sure'?
Fundamental Axiom of the Universe (aka Murphy's Law): Whatever can go wrong, will go wrong.
First Digital Deduction: Nothing obeys Murphy's Law so well as computers.
Second Digital Deduction: Everything go wrong at least once.
Third Digital Deduction: Things go wrong even when there's absolutely no possibility of anything go wrong.
Offline
If you want to execute a script at a particular time, you should use crontab -e. If you just want the script to execute regardless of the time, you should drop it in the appropriate folder. And no, you don't need to do anything else just "to make sure".
Anyway to troubleshoot any problem with the script, you should check the cron logs.
Last edited by x33a (2013-07-19 05:32:41)
Offline
Thanks folks!
Fundamental Axiom of the Universe (aka Murphy's Law): Whatever can go wrong, will go wrong.
First Digital Deduction: Nothing obeys Murphy's Law so well as computers.
Second Digital Deduction: Everything go wrong at least once.
Third Digital Deduction: Things go wrong even when there's absolutely no possibility of anything go wrong.
Offline
With the /etc/cron.hourly directory, you could use that, but it is actually just run as an hourly regular cronjob, not by anacron like the others. I presume this is because it is a regular enough interval that it will likely be run fairly consistently.
cron is responsible for running anacron via cron.hourly. So it would be circular for anacron to run stuff in cron.hourly which would run anacron which would run stuff in cron.hourly...
I actually have a backup script in cron.hourly. I do that because I want to check 2 conditions: existence of external drive for backup and time since last run. That it ran in 2 hours ago does me no good if the drive wasn't connected. Likewise, I don't want it to run again if it was done half an hour ago and then I attach the backup.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Pages: 1