Scheduled jobs

  • Hi, I configured a scheduled jobs with this command with the "send email output" enabled:

    sudo sh /home/pi/raspberry-mcg/script/docker/plex/ 5

    each time it is executed I receive an email with this message

    /var/lib/openmediavault/cron.d/userdefined-014d8449-8363-4241-a6ee-5904509cea43: 31: /var/lib/openmediavault/cron.d/userdefined-014d8449-8363-4241-a6ee-5904509cea43: source: not found

    Going deeper

    cat /var/lib/openmediavault/cron.d/userdefined-014d8449-8363-4241-a6ee-5904509cea43
    #!/bin/sh -l
    # This file is auto-generated by openmediavault (
    # WARNING: Do not edit this file, your changes will get lost.
    sudo sh /home/pi/raspberry-mcg/script/docker/plex/ 5


    cat /home/pi/raspberry-mcg/script/docker/plex/
    docker exec plex /usr/lib/plexmediaserver/Plex\ Media\ Scanner -s $1
    echo "Lib number $1 refreshed at $(date '+%Y-%m-%d')";

    Basically each time I execute e bash script that run a command against a docker container and after prints the date.

    I receive above email (I also receive the email with the echo output).


  • Hi, I add a detail: also all others sh script I have cause the "source not found" mail.
    I execute the command configured in "Scheduled jobs" no message in the console

  • I assume your default shell does not support the command source to load other scripts.

    I'm not using source in my script and I cannot find this command in the lines automatically added to cron.d/userdefined script.

    What do you mean?
    Anyone has any hints?

  • No hints?
    Who is using the `source` command to execute scheduled job?

    I see that `userdefined-014d8449-8363-4241-a6ee-5904509cea43` script has `#!/bin/sh -l`, I changed my sh script with this line but I still have the issue

    • Official Post

    Maybe start to simplify:

    sudo - from scheduled jobs you can run the script as root, so no sudo needed

    sh - make the file executable then you don't need sh

    parameter "5" - include it in the script instead of passing it

    Does it work then?


  • sudo: ok, I can remove it using "root" as user in scheduled job. It comes from the manual command I used to test it.
    sh: ok, in fact I can execute it instead of using sh.

    parameter "5": this could be an issue. Same script is used to refresh different libraries in plex; I'll try putting it inside the script just to see if it solves the issue

  • I made changes suggested.

    Now I have the same issue with another job.
    Mail message is:

    /var/lib/openmediavault/cron.d/userdefined-fee68f4c-8454-49b2-9d8e-56c8bc8d631a: 31: /var/lib/openmediavault/cron.d/userdefined-fee68f4c-8454-49b2-9d8e-56c8bc8d631a: source: not found

    The command (runned as user `pi`) in gui is:

    I need to run the job with `pi` user to keep permission and ownership (and because I cannot see why I should use sudo).

    Right now I still receive the mail message with `source` command complain

  • After a lot of time I'm coming back to this topic. I have a script that executes a tool to download Google Photos images.

    cat /home/pi/gphotos-sync/
    #!/usr/bin/env bash
    cd /home/pi/gphotos-sync;
    /home/pi/.local/bin/pipenv run ./gphotos-sync --logfile /var/log/gphotos-sync.log --secret /home/pi/gphotos-sync/client_secret.json /home/pi/local_drive/Foto/GooglePhotos

    If I run it from terminal works fine and no strange message.

    I configured the execution in "Scheduled Jobs" setting Command with


    When I run it from Scheduled Jobs play button in the modal windows this message appears:

    /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a: 31: /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a: source: not found

    but the script runs fine. Since I enabled "send email" when it ends I receive a mail with:

    /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a: 31: /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a: source: not found
    /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a: 4: /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a: ./home/pi/raspberry-mcg/script/gphotos-sync/ not found

    What is this "source" command?

    • Official Post
  • also see the comment from votdev in post #3

    I'm going to read suggested links.
    About votdev comment, he refers to "my shell" but is the default shell configured by OMV image, or not?

    I tried via ssh and the shell has "source" command.

  • cat /var/lib/openmediavault/cron.d/userdefined-fe8457ff-1a95-4f9f-a331-e74b25603a0a and you will see.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!