Auto shutdown cron job failing - TrueNAS-12.0-U4

Hey

I already posted this problem on the truenas forum and I did get help but it did not get to a solution.
maybe I can use the knowledge on this forum to come to a solution.

https://www.truenas.com/community/threads/auto-shutdown-cron-job-truenas-12-0-u3-1.93392/#post-646777

I am running TrueNAS-12.0-U4
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

I never use cron jobs in FreeBSD/TrueNAS so not really sure what is causing the issue. Maybe someone else here will have some more insight.

Perhaps specify the full path for shutdown?

which shutdown

/sbin/shutdown

Also, the -p option seems to indicate that hardware support is required and you need to include a specified time. Perhaps use the “-h now” option instead.

-p      The system is halted and the power is turned off (hardware
         support required, otherwise the system is halted) at the
         specified time.
time    Time is the time at which shutdown will bring the system down and
         may be the case-insensitive word now (indicating an immediate
         shutdown) or a future time in one of two formats: +number, or
         yymmddhhmm, where the year, month, and day may be defaulted to
         the current system values.  The first form brings the system down
         in number minutes and the second at the absolute time specified.
         +number may be specified in units other than minutes by appending
         the corresponding suffix: “s”, “sec”, “m”, “min”, “h”, “hour”.

         If an absolute time is specified, but not a date, and that time
         today has already passed, shutdown will assume that the same time
         tomorrow was meant.  (If a complete date is specified which has
         already passed, shutdown will print an error and exit without
         shutting the system down.)

The other unlikely possibility is the cron service did not refresh and pick up the future time you specified in the cron task

I tried the following commands

shutdown -p now
/sbin/shutdown -p now
midclt call system.shutdown

Or thru a script
/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.

All these commands and script work when using “run now” doesn’t that mean that the command’s and scrips are correct.
or am i thinking too simple.

but they never work on the scheduled time.

Wim

If you are running as a script, make sure you add execute permissions (chmod a+x)

I run these commands directly in the cronjob as root not as a script.

Wim

where can i find the log files
I tried /var/log/cron but i get zsh: permission denied:

any help appreciated

Wim