“/usr/bin/midclt call system.shutdown” or “midclt call system.shutdown” cron job will no longer shutdown my Fangtooth-RC system. Has there been a change effecting this command? Thanks
N.B. I do shutdown every night so this is becoming a problem. I’m going to switch back to /sbin/shutdown now
Not that I can see reported…
Can you verify the other API calls work… and then report a bug if not fixed.
Running the command in shell, the system keeps returning a changing value:
oot@HPe-Microserver[~]# midclt call system.shutdown
12176
root@HPe-Microserver[~]# midclt call system.shutdown
12177
root@HPe-Microserver[~]# midclt call system.shutdown
12178
root@HPe-Microserver[~]# midclt call system.shutdown
12179
This is the only API call I use and would have no idea how to run other commands. Thanks
The API has been changing… so it might be that the command is not quite right.
The api client is here:
The documentation on api calls is here:
https://www.truenas.com/docs/api/scale_websocket_api.html#system
I can also confirm this behaviour on the release version 25.04 /usr/bin/midclt call system.shutdown as a cron job does nothing.
Can you confirm other API calls are working as expected?
That’s a middleware job and you’re not actually following it. This means you’re invoking it wrong and not checking its return value (i.e. it’s probably failing – possibly a validation error). midclt call system.shutdown -j
It’s most likely failing because, if you look at the documentation for the API you’re invoking it has a required argument reason: NonEmptyString
I highly recommend reviewing documentation for APIs before invoking them in cron scripts.
I am not a programmer I just want the server to shutdown after it has backed up my other system it worked fine with 24.10 what is the required argument? It has done its job shutdown at this time?
midclt call system.shutdown post_backup -j
Thankyou for your help that worked thanks
The documentation that @awalkerix referred to is accessible from the webui. Even I found it a bit hard to find.
Its under Credentials - Users - API Keys
There is an API docs page.
Users Screens | TrueNAS Documentation Hub
From there you can find system.shutdown
Noted…
Documentation on user reaction to the change is somewhat easier to find.
It is also accessible via the top right toolbar Settings > My API Keys
No disrespect but that was all I needed. Thank you for providing the solution so my system shuts down safely. I know time marches on and progress is required to provide the latest and greatest functions but when things stop working without any heads-up it can be frustrating to us non-programer types. Asking me to review API documentation (which I did and found nothing) is not the most helpful advice. If the old command had the potential to somehow corrupt the system then this was a major fix. I do believe in TrueNas and have for many years.
midclt
is the shell middleware API client distributed with TrueNAS. Any time it’s invoked you’re using our API. If some API endpoint behavior changes, the most direct way to understand the change is to look at the API documentation in the TrueNAS webui.
Again, thank you for providing the correct code to shutdown Truenas safely. Upon moving to the Philippines I realized I could no longer run my systems 24/7 because of heat and electric prices.