[BlueOnyx:24208] Re: help with crontab <- archive

Meaulnes Legler @ MailList bluelist at waveweb.ch
Sun Aug 23 15:18:00 -05 2020


thank you Michael for the fast reply!

BTW, I guess you had to answer this question already in the past, like probably other questions...

There is this BlueOnyx archive at https://mail.blueonyx.it/pipermail/blueonyx/

But one cannot browse thru the whole archive to dig for tips and tricks, one has to seek in each monthly [Thread] or [Subject] or download the zip-file and search there...

This is very cumbersome and then it's easier to ask on the list — what isn't very efficient (from your point of view, I presume:-)

Isn't there a better way?

Thanks again and best regards

ベ⊃ Meaulnes Legler
Zurich, Switzerland
+41¦0 44 260-1660


On 23.08.20 21:21, Michael Stauber wrote:
> Hi Meaulnes,
> 
>> I want to install a shell script that runs every day with crontab.
>>
>> Now I know there is some catch on BlueOnyx for doing that but I didn't
>> jot it down.
>>
>>
>> So there*is*  a crontab file but I can't edit it the normal way... can I
>> just edit /etc/crontab and add my line like
>> 5 4 * * * root /root/myScript.sh    # run myScript.sh every day at 04:05
>> without breaking anything?
>> Do I have to restart some service?
> There are a couple of different ways how this can be done.
> 
> You can use "crontab -e" to create a new Root cronjob. There isn't one
> already, but when you use "crontab -e" it'll fire up the VIM editor,
> allows you to specify your cronjob and when you than save it, you can
> see it in being present when you run "crontab -l".
> 
> Or you can put the cronjob into a file like /root/mycron and can then
> run "crontab /root/mycron" to put it into effect. Likewise: Afterwards
> "crontab -l" will show that cronjob as being present.
> 
> Another way is to put your cronjob into one of the existing config
> directories of cron:
> 
> [root at 5209r ~]# tree -d /etc/cron*|grep -v error
> /etc/cron.d
> /etc/cron.daily
> /etc/cron.half-hourly
> /etc/cron.hourly
> /etc/cron.monthly
> /etc/cron.quarter-daily
> /etc/cron.quarter-hourly
> /etc/cron.weekly
> 
> Take a look at the scripts that are already in these directories to get
> some idea. Whatever is in /etc/cron.daily gets executed once per day.
> 
> Whatever is in/etc/cron.d/  gets executed by the time configured in the
> config files.
> 
> Example:
> 
> [root at 5209r ~]# cat /etc/cron.d/swatch.cron
> # swatch is the system watcher
> */15 * * * *    root    /usr/sausalito/sbin/swatch.sh >/dev/null 2>&
> 
> As you can see there, /etc/cron.d/swatch.cron makes sure that
> /usr/sausalito/sbin/swatch.sh gets executed every 15 minutes.
> 
> Typically when I add cronjobs, I just put a config file like this into
> /etc/cron.d/, as it's the easiest and most transparent way.
> 
> When you create such a new config file, it is best to restart crond like
> this: "systemct restart crond".
> 
> -- With best regards Michael Stauber





More information about the Blueonyx mailing list