0

So I am running libreelec and would like to run a script every time the pc boots and then every hour after.

I have a command that launches the script in a screen and running it works fine.

I have set this up as a cron job with @reboot and every hour, but the script does not run.

I have asked it to output to a log file and the @reboot does not even create the crontv.log but the hourly one makes the log file but the script does not run.

The script itself creates another log file, but this never gets created unless I run the script manually.

This here shows the crontab and then the ls command run before and after the cron job is supposed to run:

LibreELEC:~ # crontab -l
@reboot /storage/.kodi/addons/virtual.system-tools/bin/screen -dmS sync /storage/scripts/sync.sh > /storage/crontv.log
37 * * * * /storage/.kodi/addons/virtual.system-tools/bin/screen -dmS sync /storage/scripts/sync.sh > /storage/cron.log
LibreELEC:~ # ls -lh
total 72
drwxr-xr-x   10 root     root        4.0K May 20 16:25 Cinema Visiom
drwxr-xr-x  302 root     root       20.0K Jun  1 22:44 Films
drwxrwxrwx  148 root     root        4.0K Jun  5 19:22 TV
drwxr-xr-x    2 root     root        4.0K May 14 20:16 backup
drwx------    2 root     root       16.0K May 14 20:08 lost+found
drwxr-xr-x    2 root     root        4.0K May 14 20:16 music
drwxr-xr-x    2 root     root        4.0K May 14 21:38 oldbackup
drwxr-xr-x    2 root     root        4.0K May 14 20:16 pictures
drwxr-xr-x    2 root     root        4.0K May 14 20:16 screenshots
drwxr-xr-x    2 root     root        4.0K May 20 15:39 scripts
drwxr-xr-x    2 root     root        4.0K May 15 21:28 zips
LibreELEC:~ # ls -lh
total 72
drwxr-xr-x   10 root     root        4.0K May 20 16:25 Cinema Visiom
drwxr-xr-x  302 root     root       20.0K Jun  1 22:44 Films
drwxrwxrwx  148 root     root        4.0K Jun  5 19:22 TV
drwxr-xr-x    2 root     root        4.0K May 14 20:16 backup
-rw-r--r--    1 root     root           0 Jun  5 19:57 cron.log
drwx------    2 root     root       16.0K May 14 20:08 lost+found
drwxr-xr-x    2 root     root        4.0K May 14 20:16 music
drwxr-xr-x    2 root     root        4.0K May 14 21:38 oldbackup
drwxr-xr-x    2 root     root        4.0K May 14 20:16 pictures
drwxr-xr-x    2 root     root        4.0K May 14 20:16 screenshots
drwxr-xr-x    2 root     root        4.0K May 20 15:39 scripts
drwxr-xr-x    2 root     root        4.0K May 15 21:28 zips
LibreELEC:~ #
1
  • Could you say what directory it is that you show the listing of above? The log files are created in /storage.
    – Kusalananda
    Commented Aug 10, 2020 at 8:15

1 Answer 1

0

screen as invoked won't write anything to the log file. You probably ought to add the logging to sync.sh.

1
  • As I said, the script should also write a log file, but when the cron job runs the log file does not get written. This is how I know that cron seems to be failing instead of the script.
    – James
    Commented Jun 5, 2017 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .