- ベストアンサー
- 困ってます
/etc/crontabに記述してあるのに一部のスクリプトの実行結果が通知されない
RedHat9を使用しています。 # cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ 00,12,24,36,48 * * * * root run-parts /etc/cron/networkDown.cron 05 * * * * root run-parts /etc/cron/top_c.cron # ls -l /etc/cron/ drwxrwxr-x 2 root root 4096 1月 13 01:38 networkDown.cron/ drwxrwxr-x 2 root root 4096 11月 15 14:23 ntp.cron/ drwxrwxr-x 2 root root 4096 11月 26 14:24 top_c.cron/ # ls -l /etc/cron/networkDown.cron -rwxr-xr-x 1 root root 481 2月 28 2004 diskSpaceCheck.cron* -rwxr-xr-x 1 root root 2938 8月 5 15:33 networkDown.cron* -rwxr--r-- 1 root root 206 11月 30 23:56 popAccessCheck.cron* -rwxr--r-- 1 root root 543 1月 13 01:37 printSeverCheck.sh* となっていますが何故か/etc/cron/networkDown.cronディレクトリだけの実行結果がroot宛に通知されません。 /etc/cron/top_c.cronの実行結果はroot宛に通知されます。 # tail -f /var/log/cron には # crontab -l で表示される分のcronの処理結果しか吐かれないようです。 どうして、一部のディレクトリだけの実行結果が通知されないのでしょうか?
- hhozumi
- お礼率79% (132/167)
- Linux系OS
- 回答数1
- ありがとう数1
- みんなの回答 (1)
- 専門家の回答
質問者が選んだベストアンサー
- ベストアンサー
- 回答No.1
- Aruku-20030515
- ベストアンサー率23% (362/1544)
じゃぁ逆に考えましょう なんぜcronから起動するスクリプトからメールが送られるのか。 このへんを理解できれば納得できると思われます。 問題となっているあなたの環境が 詳しくかかれていないのでこれ以上はわかりません
関連するQ&A
- cronの実行結果通知メールの配信をさせないようにするには?
RedHat9を使用してます。 # cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ : # crontab -l | more # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.12227 installed on Thu Feb 3 02:58:29 2005) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) # crontab -e SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ : としていて、 記述が増えるに従ってcron実行済みの通知メール数が多くなってきましたので 配信させないように双方とも MAILTO="" してみたのですが相変わらず届いてしまいます。 相変わらずローカルのrootが送信しているようです。 どうすれば配信させないようにできるのでしょうか?
- ベストアンサー
- Linux系OS
- crontabの設定ができない(編集画面が出ない)
CentOS5.2を使っています。 crontabの設定を行おうと、 # chkconfig --list crond crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off で確認後、$ crontab -e としましたが、 no crontab for aaabbb - using an empty one と出て、編集ファイルが表示されません。 $ crontab -l とすると no crontab for aaabbb と出、 # crontab -l も no crontab for root となります。 念のため # chmod 777 /etc/crontab としてみましたが、結果は同じです。 $ less /etc/crontab でファイルを開くと ------------------------ SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly /etc/crontab (END) ---------------------- となっています。 Webで設定例を検索すると、no crontab for aaabbb - using an empty one の下に crontab: installing new crontab と出ると記載されているのですが、 私の場合、このような表示や動きは出ませんが、どのようにして crontab を設定していくのでしょうか。どうか宜しくお願いします。
- ベストアンサー
- Linux系OS
- crontabの自動実行について (Debian3.0)
OSはDebian GNU/Linux 3.0です。 /etc/cron.daily の中にviで記述した下記のものを 保存しました。ファイル名back.sh #!/bin/sh rsync -acouv --stats /home/www /backup/back-all ;; しかし、自動実行できていませんでした。 www、back-all共に実在するディレクトリです。 crontabは下記のとおり、初期のままです。 SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 25 6 * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily 47 6 * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly 52 6 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly # 何か間違いがあるのでしょうか?
- ベストアンサー
- Linux系OS
- postfix インストール時のエラー
Sol10にpostfixをインストールしようとしています。 makeも終わって、make installしようとすると、 > Killed > /usr/local/etc/postfix/post-install: Error: no /usr/local/sbin/postconf command found. というエラーが出ます。 /usr/local/sbinにpostconfってのがないってことだな、と思ってみてみると、 > root# ls -l /usr/local/sbin > 合計 9248 > -rwxr-xr-x 1 root root 501908 6月 24日 23:07 postalias > -rwxr-xr-x 1 root root 339932 6月 24日 23:07 postcat > -rwxr-xr-x 1 root root 573064 6月 24日 23:07 postconf > -rwxr-sr-x 1 root postdrop 539416 6月 24日 23:07 postdrop > -rwxr-xr-x 1 root root 303108 6月 24日 23:07 postfix > -rwxr-xr-x 1 root root 337452 6月 24日 23:07 postkick > -rwxr-xr-x 1 root root 330140 6月 24日 23:07 postlock > -rwxr-xr-x 1 root root 307524 6月 24日 23:07 postlog > -rwxr-xr-x 1 root root 473420 6月 24日 23:07 postmap > -rwxr-sr-x 1 root postdrop 534724 6月 24日 23:07 postqueue > -rwxr-xr-x 1 root root 355132 6月 24日 23:07 postsuper 問題なくあるようです。 何が原因でしょうか。 以下参考です。パスと、作成したユーザとグループです。 > root# echo $PATH > /usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin:/usr/local/sbin > root# more /etc/passwd > (中略) > postfix:x:101:100::/home/postfix:/bin/sh > root# more /etc/group > (中略) > postfix::100: > postdrop::101: よろしくお願いいたします。
- ベストアンサー
- Solaris系OS
- バックアップの自動化に出てくる run-parts とは?
Fedora Core2 にてバックアップの自動化を調べていて、crondを見つけたのですが、run-partsの意味が良くわかりません。コマンドなのかと思って調べてみましたが、よくわかりませんでした。run-partsとはどういった意味があるのでしょうか。 SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly
- ベストアンサー
- Linux系OS
- fedoraのcrontabについて
linux初心者です。 今、fedora16で「新Linux/UNIX入門」という本を使って、Linuxを勉強しています。 crontabについて一つわからないことがあります。 本では/etc/crontabに 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly の記述があると書かれてありますが、自分のパソコンで$ cat /etc/crontabを実行してみると SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed となり、記述されているはずのものがありません。 ここではなく、/var/spool/cron/rootの方に記述されているかと思って、その中も見てみたのですが、記述されていそうにありません。 どこにこれは記述されているのでしょうか? いろいろといじくっているうちに、誤って自分で消してしまったのでしょうか? どなたかご回答よろしくお願い致します。
- ベストアンサー
- Linux系OS
- crontabでのシェル自動実行がNG
いつも参考にさせてもらっています。 linux(Red Hat Enterprise Linux ES release 3 Apache/2.0.46)上でcrontabを設定したいのですが、 現在うまくいっておりません。 まず、autoindex.shというシェルを/home/foo/scripts/ディレクトレィに作成しました。中身は3行からなっていて #!/bin/sh cd /var/www/html/search/index mknmz -a /var/www/html/test です。telnet上でroot権限を使用し、./autoindex.shコマンド発行で正常に動作しました。 そこで、crontabに以下のように # crontab -l 50 11 * * * root /home/foo/scripts/autoindex.sh と設定したところ、 # more /etc/log/cron Sep 27 11:50:01 intra crond[18280]: (root) CMD (root /home/foo/scripts/autoindex.sh ) とcronは決めていた時間(11時50分)に稼動しているようなんですが、mailを見ると # mail -t From root@XXX.com Wed Sep 27 11:50:01 2006 Date: Wed, 27 Sep 2006 11:50:01 +0900 From: root@XXX.com (Cron Daemon) To: root@XXX.com Subject: Cron <root@hoge> root /home/foo/scripts/autoindex.sh X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/root> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=root> X-Cron-Env: <USER=root> /bin/sh: line 1: root: command not found と、シェルがこけているようです。 何か解決のヒントがありましたら、ぜひ教えていただけないでしょうか。
- ベストアンサー
- その他([技術者向] コンピューター)
- crontabコマンドはどこに記述されますか?
RedHatLinux9を使用しています。 毎日2時にテープにバックアップをとろうと バックアップ用のスクリプトを作って #crontab -e 00 2 * * * /root/backup.sh としました。 これはどこに記述してあるのでしょうか? /etc/crontabにはないですし /etc/cron.daily/の中にもないので。 きちんと動いているのですが 確認したいんです。 よろしくお願いします。
- ベストアンサー
- Linux系OS
- crontab -lの結果取得
教えて下さい。 <? $lines = shell_exec("crontab -l"); echo $lines; ?> 上記結果でcronのジョブ一覧を取得したかったのですが、期待通りの結果が返ってきませんでした。(何も取得できませんでした。) crontab -l自体は通常のコマンドとして使えているのですが、、 実行ユーザーの問題かと思い、"crontab -u root -l"ともしてみましたが結果は同じでした。 また、パスの問題かと思い、"/usr/bin/crontab -u root -l"ともしてみましたが結果は同じでした。 この場合、どこが問題となっているのでしょうか。 宜しくお願い致します。 FedoraCore9 php-5.2.5-7.fc9.i386 httpd-2.2.9-1.fc9.i386
- ベストアンサー
- PHP
- cron設定で電源のOFFができません。
cron設定で電源のOFFができません。 cent OS 5.5 で自宅サーバーを立上げ勉強中です。 サーバーの電源を自動で18:00にONにして翌日の7:00にOFFにしたいと思います。 いろいろなホームページを参考にさせていただき、電源のONはパソコンのBIOS設定、OFFは"cron"を使うことできることがわかりました。 電源のONはパソコンのBIOS設定でできましたが、OFFができません。 設定は以下としています。 [root@Linux ~]# vi /etc/crontab CSHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly 0 7 * * * shutdown -h now #追加 [root@Linux ~]# /etc/rc.d/init.d/crond restart [root@Linux ~]#chkconfig crond on [root@Linux ~]# chkconfig --list crond crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@Linux ~]# /etc/rc.d/init.d/crond status crond (pid xxx) を実行中... 設定時間になっても電源がOFFになりません。 [root@Linux ~]# shutdown -h now ではOFFにできます。 (cent OS 5.5 をインストールしているパソコンは 富士通 FMV DESKPOWER CE18B 2002 年製です) よろしくお願いします。
- ベストアンサー
- Linux系OS
質問者からのお礼
リブートしましたら、上手くいきました。 topで凄く、プロセス600個以上が実行されていまして、 シェルスクリプトの作成ミスでどんどんプロセスが溜まりに溜まって、crondの不具合が生じていました。
質問者からの補足
有難うございます。 直接このスクリプトを実行してみましたら、チャンとメールは送られました。 、、、という事はcronがこのスクリプトを置いてあるディレクトリを読み込めてないという事ですかね。 パスのスペルミスとか一応チェックはしてみたのですが