Score:0

getting permission denied errors with cronjobs and logs on rpi

ng flag

Hell everyone.

I am running a raspberry pi 3B+. I have a a cronjob that runs a script (which seems to work fine) but when I look at the syslog I see errors, which you can find below.

I can't really figure out what is wrong, and I wonder if you guys do know. my mail (cat /var/mail/pi) shows nothing.

I do run log2ram, if that makes any difference..

my crontab looks like this:

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

The script it runs looks like this:

#!/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

and the syslog (grep cron /var/log/syslog -B 5 -A 5) looks like this:

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)
cn flag
Bob
Cron uses mail to send all output of the batch to the batch owner or the designated recipient. The reason seem that you don't get mail is probably related to the error message `cannot open main log file "/var/log/exim4/mainlog": Permission denied` indicating that you mail setup is broken. That's where you need to start debugging.
S. ten Brinke avatar
ng flag
@Bob Hey bob, thanks for your reply. I am only a novice when it comes to linux, so I would find it difficult to know where to even start. How is "exim4" and mail related? What even is exim4?
cn flag
Bob
https://www.exim.org/
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.