UJP - 技術情報1

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

macosでcronのログを出すようにする

macosでcronのログを出すようにする


更新履歴

  • 初版 2019/06/02

はじめに

  • macosでは,cron.logが出ないようなので,これを出すようにする.

/etc/syslog.confを確認

  • 現在のsyslog.confを確認.
       $ cat /etc/syslog.conf🆑
       # Note that flat file logs are now configured in /etc/asl.conf
       
       install.*						@127.0.0.1:32376
       
       # used for the adaptive firewall: man emlog.pl
       auth.*                                @127.0.0.1:60762
  • cron.logに関する記述がない.

syslog.confを編集

  • 編集前にバックアップ.
       $ sudo cp -p /etc/syslog.conf /etc/syslog.conf.v00🆑
       Password:🆑
       $ ls -la /etc/syslog.conf*🆑
       -rw-r--r-- 1 root wheel 200  2  4  2018 /etc/syslog.conf
       -rw-r--r-- 1 root wheel 200  2  4  2018 /etc/syslog.conf.v00🈁
       -rw-r--r-- 1 root wheel  96  2 26  2016 /etc/syslog.conf~previous
  • 編集後の内容を確認.
       $ cat /etc/syslog.conf🆑
       # Note that flat file logs are now configured in /etc/asl.conf
       
       install.*						@127.0.0.1:32376
       
       # used for the adaptive firewall: man emlog.pl
       auth.*                                @127.0.0.1:60762
       #cron log🈁
       cron.* /var/log/cron.log🈁
  • 差分を確認.
       $ diff /etc/syslog.conf.v00 /etc/syslog.conf🆑
       6a7,8
       > #cron log
       > cron.* /var/log/cron.log
       $

反映させる

  • syslogdを再起動して設定内容を反映させる.
       $ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist🆑
       /System/Library/LaunchDaemons/com.apple.syslogd.plist: Operation not permitted while System Integrity Protection is engaged🈁
       $
  • 今回はmacos 10.3のHigh Sierraで試したが,El Capitan(10.11)以降に搭載された,System Integrity Protectionが効いてしまって,残念ながら反映できない.
  • 本来なら,次のようなコマンドでsyslogdを再起動できる.(今回はメモ)
       sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
       sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

広告スペース
Google