Shell script does nothing called via crontab

Hi all,

I have a strange behavior of a script,
If I run it directly from a root-account, it does, what it should do.

    sh /etc/shellscripte/fotos/fotos/ > /home/xy/ftest.log

If I run it via crontab (cronie) it does nothing.

    36 17   * * *   root    sh /etc/shellscripte/fotos/fotos/ > /home/xy/fotos.log

The content of the script is

exiftool  -charset utf-8 -csv -m -fast -r -ext jpg -c %.6f -Filename -Directory -CreateDate -XResolution  -YResolution -exif:gpslatitude -exif:gpslongitude -xmp:Description -ImageWidth -ImageHeight  /home/bilder/dir001   /home/bilder/dir002  /home/bilder/dir003  /home/bilder/dir004  /home/bilder/dir005  /home/bilder/dir006  /home/bilder/dir007  /home/bilder/dir008  /home/bilder/dir009 > ./allefotos.csv

Could anybody give me a hint, what could be the difference between the execution between the shell and via crontab?



First, this command sends its output to the home directory of the xy user.


sends (or tries to send) the output to the /~xy directory which may not exist. The commands probably fails silently.
I would therefore explicitly write /home/xy/fotos.log if it is indeed where it is expected to save the output.

Yes… those were typos… I have corrected them.

Did you checked if cornie is actually running?

systemctl status cronie

Did you see something in the journal?

sudo journalctl -u cronie --no-hostname --no-pager


Apr 06 17:36:01 CROND[1654013]: (root) CMD ( sh /etc/shellscripte/fotos/fotos/ > /home/xy/fotos.log) Apr 06 17:36:01 CROND[1654011]: (root) CMDOUT (/etc/shellscripte/fotos/fotos/ Zeile 1 exiftool: command not found.)

That is strange: I can start exiftool from bash. Is with cronie another path configured?

Yes, by default, the PATH in crontab in minimal. Better put the full path in front of your command.

It should be just /usr/bin:/bin

Thank you

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.