#Informatique, Debian
Debian - Liste des crons de tous les utilisateurs
28 juillet 2017 Rédigé par Djin
Quand on a un serveur avec plusieurs utilisateurs ou plusieurs applications, il peut être très intéressant de pouvoir lister les crons de chaque utilisateur.
On parle de compte utilisateur standard, ou de compte crée pour des applications comme nagios ou glpi.
Pour cela, on va créer un alias :
alias cronall='for user in $(cut -f1 -d: /etc/passwd); do echo -e "\n\n==> $user:" && crontab -u $user -l; done'
Maintenant, nous n'avons plus qu'à lancer notre alias pour voir le résultat :
cronall
==> root:
MAILTO=""
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#toutes les heure verifie l'IP
#0 */1 * * * /root/script/IpChange/IpChange.sh >/dev/null 2>&1
* * * * * /usr/bin/php /root/script/IpChange/modifIP.php >> /root/script/IpChange/modifIP.log 2>&1 #tous les jours a minuit save Site et BDD
0 0 * * * /root/script/savesite.sh
==> daemon:
no crontab for daemon
==> bin:
no crontab for bin
==> _apt:
no crontab for _apt
==> root:
MAILTO=""
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#toutes les heure verifie l'IP
#0 */1 * * * /root/script/IpChange/IpChange.sh >/dev/null 2>&1
* * * * * /usr/bin/php /root/script/IpChange/modifIP.php >> /root/script/IpChange/modifIP.log 2>&1 #tous les jours a minuit save Site et BDD
0 0 * * * /root/script/savesite.sh
==> daemon:
no crontab for daemon
==> bin:
no crontab for bin
==> _apt:
no crontab for _apt
Etc ...
Source : http://blogmotion.fr/systeme/list-cron-job-all-users-4395
Information sur Djin, l'auteur de l'article
L'informatique est d'abord une passion avant d'être mon métier.