Auto shutdown cron job - TrueNAS-12.0-U3.1

Wim1969

Dabbler
Joined
Jan 10, 2021
Messages
10
Hey

I have a Cronjob with the following parameters

Description: shutdown test
Command: shutdown -p now
Run as user: root
Schedule: Custom (16 * 14 * *)
Hide standard output disabled
Hide standard error not checked
Enabled checked

If I test this job with "run now", I always work.
But it does not work at the scheduled time.

When I look at ui/system/general I can see that the time zone and current time are correct.

If I set a time in the track that is 3 minutes away, it says Next run: in 3 minutes.
But nothing happens

Any help appreciated

Wim
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
try with midclt call system.shutdown instead...
 

Wim1969

Dabbler
Joined
Jan 10, 2021
Messages
10
Thanks for the quick response.

I have tried it, with exactly the same result.

If I test this job with "run now", I always work.
But it does not work at the scheduled time.

Wim
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
Can you show how you have configured the schedule?
 

Wim1969

Dabbler
Joined
Jan 10, 2021
Messages
10
01 Cron Job fail.jpg
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
OK, so what if you make a script file:
Code:
#! /bin/sh
/usr/local/bin/midclt call system.shutdown


Save it to your pool for example in /mnt/tank/scripts.

Then mark it executable: chmod +x /mnt/tank/scripts/shutdown.sh

Then execute that with the cron job...
 

Wim1969

Dabbler
Joined
Jan 10, 2021
Messages
10
Hey
Thank you for the answer.

I have created this file.
/mnt/Data_Pool_1/scripts/shutdown.sh

Contents of the file.
#! / bin / sh
/usr/local/bin/midclt call system.shutdown

The file has also been made executable.

But this method also only works with "run now" but not via a schedule


Wim
 

Wim1969

Dabbler
Joined
Jan 10, 2021
Messages
10
So we now have 3 valid commands that work fine when executed with "run now".
But none of them work on a schedule.

How can I check if the cronjobs are active.
I have searched and I understand that the tasks are no longer in crontab but in a database?
And where can I find log files.

Wim
 
Top