Script Help: Cron Task does not execute at specified time or on "Run Now"

Status
Not open for further replies.

douglasg14b

Dabbler
Joined
Nov 26, 2017
Messages
26
Freenas 11.1

I setup a cron task in the GUI, and have tried running it, but it does not seem to run. I've set it up as the root user, and put the full path to the shell script it's supposed to run.

I'm trying to test to see if this works by using the "Run Now" button.

The command:
/root/bin/EsxiBackupManager/run.sh

If I paste this command into an ssh shell it runs as expected, the script outputs it's logs to the appropriate file. If I click the "Run Now" button, it says the cron process started, but no output goes to the log file to indicate it ran.

There are no entries in /var/log/cron when I use "Run Now". There is an entry when the cron job runs itself. There are also no entries in /var/log/debug.log when the cron job runs on it's own.

Why might this be happening? How can I debug this?
 

douglasg14b

Dabbler
Joined
Nov 26, 2017
Messages
26
I tried using a test command for the command portion of the cron job mkdir /root/bin/EsxiBackupManager/test and it worked just fine.

Is there something special that must be done to run a script from the cron job?

Edit: Tried /bin/bash /root/bin/EsxiBackupManager/run.sh as well. The permissions on run.sh have execute.

Tried using a simple script:

Code:
#!/bin/bash
mkdir test


And it didn't create the dir, but it did when ran from a shell.

Tried creating a simple python script and running in the task with the command /usr/local/bin/python /root/bin/EsxiBackupManager/test.py and it didn't seem to execute either...
 
Last edited:

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
bash is not in /bin on FreeBSD, that is a Linuxism. Use /usr/local/bin/bash if the script really requires bash, or use /bin/sh (preferable).
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
It's funny, isn't it, people think Linux is the way this is done, not realizing that Linux is actually an interloper/weird usage.
 
Status
Not open for further replies.
Top