Shut down cron schedule not working (25.04.0)

Hello,

I wonder if anyone can help.

I have a machine that I upgraded to Scale from Core a good few months ago, the shutdown cron used to work without issue.

25.04.0 is currently installed and it appears that a shutdown schedule isn’t work - I’m wondering if it’s because of the upgrade and import of the original config file.

I have tried:

  • /sbin/shutdown -p now

  • /usr/bin/midclt call system.shutdown

  • midclt call system.shutdown

Things to confirm/note or that I’ve tried:

  • Ensured that the task is enabled and a suitable time is scheduled
  • Due to the import of an earlier config, the user used for this command is ‘root’ and not the standard TrueNAS Scale user “Truenas_admin”.
  • Deleted the task and re-created.

Really no hurry with this, just a curiosity, thanks in advance!

midclt is our middleware API client and so any scripts using it must account for API changes.
The API for system.shutdown changed in 25.04 such that it takes an additional mandatory positional argument reason that explains why the shutdown is occurring.

1 Like

Thank you, so should I do:

midclt call system.shutdown reason.general

Or similar?

Something like midclt call system.shutdown "my cronjob"

Wonderful, it worked, thank you very much @awalkerix :+1:

sorry, my current command line :
usr/bin/midclt call system. Shutdown

should I just replace it with this one??
midclt call system.shutdown “my cronjob”

You can replace “my cronjob” with whatever you want. Some identifier that it’s this job vs something you’re doing though the UI.

like? can you write the command line please?

The text “my cronjob” is just an example. The text doesn’t have to be “my cronjob”, it can be anything you like. But there has to be some text otherwise it won’t shutdown.

Here are some more examples:

midclt call system.shutdown "Wife demanded I shut the server down again because it's so loud"
midclt call system.shutdown "Thunderstorm incoming, better shut down all the electronics"
midclt call system.shutdown "sdfjnsdfjnsdflfs just let me shutdown"

It’s just some text recording the reason for the shutdown, it will show up in the logs.

It’s possible you need to prefix it with “/usr/bin/” like you had it before - I don’t recall, try it without and if it fails add it:

/usr/bin/midclt call system.shutdown "sdfjnsdfjnsdflfs just let me shutdown"
2 Likes

Whork Fine :slight_smile:

/usr/bin/midclt call system.Shutdown"just let me shutdown"

No space :wink: