0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cron設定を確認する方法

Posted at

概要

サーバー内にて、どのユーザーがどういった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] 
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?