'nnamo bene!
solitamente si ha a disposizione una configurazione di cron di pronto utilizzo con directory per i task orari, giornalieri, settimanali e mensili, nonche' un file crontab predisposto.
A seconda della distro utilizzata queste impostazioni possono variare.
Esempio per slack di /var/spool/cron/crontab/root
codice:
# If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null. We'll do this here since these jobs should run
# properly on a newly installed system, but if they don't the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this. If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
Un file simile su Debian lo troviamo in /etc/crontab
Sempre in /etc troviamno le seguenti dir:
codice:
[sergio@winnie ~]$ ls -ld /etc/cron.*
drwxr-xr-x 2 root root 80 2005-03-20 22:02 /etc/cron.d
drwxr-xr-x 2 root root 328 2005-03-20 22:02 /etc/cron.daily
drwxr-xr-x 2 root root 80 2005-03-20 22:02 /etc/cron.hourly
drwxr-xr-x 2 root root 136 2005-03-20 22:28 /etc/cron.monthly
drwxr-xr-x 2 root root 152 2005-03-20 22:27 /etc/cron.weekly
Ora, puoi creare uno script bash in cui raccogli i comandi
per l'esecuzione del task quotidiano:
codice:
#!/bin/bash
#
# /etc/cron.daily/clock
#
# update clock from remote NTP server
ntpdate ntp1.ien.it
hwclock
Salvi questo script in /etc/cron.daily/clock e automagicamente verrà eseguito nell'orario impostato in crontab, nell'esempio di cui sopra, alle ore 4:40 di ogni giorno.
Questo è quanto. Dovrebbe essere corretto, spero.
ciao.