basic cron job help

Status
Not open for further replies.

gayle30

Dabbler
Joined
Nov 27, 2016
Messages
17
im running the supermicro x11 motherboard which ties all fans to CPU temp and ignores my HDD temps.

Im trying to run the script from here every three minutes: https://forums.freenas.org/index.ph...ponse-to-hard-drive-temperatures.41294/page-4

Ive read the info here: http://doc.freenas.org/9.10/tasks.html#cron-jobs but it doesnt reeally tell you what to do.

when i add a cron job ive set the user to 'root'..

however in the command line im not sure what to put?

i created a dataset called 'scripts' and put the txt of the script in there then put the command as:

sh /mnt/zpool/backups/scripts/fan.sh

is this correct? im just totally lost as to what to put as the command and to check if the cron job is running correctly.

Edit: i keep getting this email when the cron job tries to run:

Email Title: Cron root@freenashost PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" sh /mnt/zpool/backups/scripts/temp.sh > /dev/null

email Body:
/mnt/zpool/backups/scripts/temp.sh:
: not found
/mnt/zpool/backups/scripts/temp.sh: cannot create /var/cover
: Permission denied
/mnt/zpool/backups/scripts/temp.sh:
: not found
camcontrol: subcommand "cmd" requires a valid device identifier
/mnt/zpool/backups/scripts/temp.sh: 15: Syntax error: "elif" unexpected (expecting "then")
 
Last edited:

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I'm not clear which script you're trying to use. If it's my PID fan control script on that page, there are more recent versions here.

You don't need a separate dataset, you can put the script anywhere. When setting up the cron job in the FreeNAS GUI, just put the complete path and name of the script. No sh in front. If you do need sh, you would need the full path to it. And my scripts are bash, so it would be bash, not sh.

Somehow, it looks like from the email you are running 'temp.sh' not 'fan.sh'. In fan.sh, is there any reference to temp.sh? Whatever script is running, it seems to not be working right. Assuming the script is OK, you could try deleting the cron job and doing it over.

Also make sure the script is executable ( chmod +x fan.sh ). If the script works when invoked directly on the command line, that's not the problem.

Operationally, you would probably want to run it as a post-init script, so it starts after booting.
 
Status
Not open for further replies.
Top