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.
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"