使用 cronjobs 和 rpi 上的日志时出现权限被拒绝错误

使用 cronjobs 和 rpi 上的日志时出现权限被拒绝错误

大家见鬼去吧。

我正在运行 raspberry pi 3B+。我有一个运行脚本的 cronjob(似乎运行良好),但当我查看 syslog 时,我看到了错误,您可以在下面找到这些错误。

我真的不知道哪里出了问题,我想知道你们是否知道。我的邮件(cat /var/mail/pi)什么都没有显示。

我确实运行了 log2ram,看看这有什么区别。

我的 crontab 如下所示:

0 */4 * * * sh /home/pi/Projects/refresh-web-os.sh

它运行的脚本如下所示:

#!/bin/sh

sessionToken=$( ssh -i <<CREDENTIALS>> -o StrictHostKeyChecking=no -p <<PORT>> <<SSH_ADDRESS> cat /var/luna/preferences/devmode_enabled )

if [ -z "${sessionToken}" ]; then
  echo "sessionToken is empty"
  sessionToken=$(cat /tmp/webos_devmode_token_tv.txt)
else
  echo "saving session token in temporary file (/tmp/webos_devmode_token_tv.txt)"
  echo ${sessionToken} > /tmp/webos_devmode_token_tv.txt
fi

if [ -z "${sessionToken}" ]; then
  echo "Unable to get token" >&2
  exit 1
fi

checkSession=$(curl --max-time 3 -s "<<CURL_CALL>>")

echo $checkSession

并且 syslog( grep cron /var/log/syslog -B 5 -A 5) 如下所示:

Feb  1 04:00:01 raspberrypi CRON[23440]: (pi) CMD (sh /home/pi/Projects/refresh-web-os.sh)
Feb  1 04:00:01 raspberrypi CRON[23441]: (root) CMD (   PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker local)
Feb  1 04:00:07 raspberrypi cron[413]: 2022-02-01 04:00:07 1nEjOp-00066P-0e Cannot open main log file "/var/log/exim4/mainlog": Permission denied: euid=112 egid=119
Feb  1 04:00:07 raspberrypi cron[413]: 2022-02-01 04:00:07 1nEjOp-00066P-0e <= pi@raspberrypi U=pi P=local S=717
Feb  1 04:00:07 raspberrypi cron[413]: 2022-02-01 04:00:07 1nEjOp-00066P-0e Cannot open main log file "/var/log/exim4/mainlog": Permission denied: euid=112 egid=119
Feb  1 04:00:07 raspberrypi cron[413]: exim: could not open panic log - aborting: see message(s) above
Feb  1 04:00:07 raspberrypi exim[23461]: 2022-02-01 04:00:07 1nEjOp-00066P-0e <= pi@raspberrypi U=pi P=local S=717
Feb  1 04:00:07 raspberrypi exim[23461]: 2022-02-01 04:00:07 1nEjOp-00066P-0e Cannot open main log file "/var/log/exim4/mainlog": Permission denied: euid=112 egid=119
Feb  1 04:00:07 raspberrypi exim[23461]: exim: could not open panic log - aborting: see message(s) above
Feb  1 04:00:07 raspberrypi CRON[23439]: (pi) MAIL (mailed 141 bytes of output but got status 0x0001 from MTA#012)

相关内容