概要
サーバー内にて、どのユーザーがどういったcronを動かしているのか確認する方法です。
コマンド
for u in $(cut -d: -f1 /etc/passwd); do
crontab -u "$u" -l 2>/dev/null | sed "s/^/[user:$u] /"
done
このユーザーでこの処理が走ってるんだ〜と一覧で見ることができます。
#実行例
[root@web01 ~]# for u in $(cut -d: -f1 /etc/passwd); do
> crontab -u "$u" -l 2>/dev/null | sed "s/^/[user:$u] /"
> done
[user:root] MAILTO=root@localhost
[user:root] */5 * * * * /root/scripts/monitor/check_service.sh > /dev/null
[user:root] */5 * * * * /root/scripts/monitor/check_port.sh > /dev/null
[user:root] #*/5 * * * * /root/scripts/monitor/check_process.sh > /dev/null
[user:root] */5 * * * * /root/scripts/monitor/check_cpu_memory.sh > /dev/null
[user:root] 0 * * * * /root/scripts/monitor/check_disk.sh > /dev/null
[user:root]
[user:root] # SSL
[user:root] 00 5 * * 1-5 ( cd /opt/dehydrated; /opt/dehydrated/dehydrated -c ) > /tmp/dehydrated.log 2> /tmp/dehydrated_err.log
[user:root]
[user:root]
[user:root] 0 * * * * cd /opt/jp-secure/siteguardlite;./siteguardlite_statistics.sh
[user:root] 0 10 * * 1 cd /opt/jp-secure/siteguardlite;./dbupdate_waf;./dbupdate_country
[user:apache] MAILTO=root@localhost
[user:apache]
[user:apache] # MT
[user:apache]