SOLVED Shutdown Reasons - Is there any way around so I can auto shutdown

Scale
Platform:
Generic
Edition:
Community
Version:
25.04.2.3

Just encountered this ‘Reason when shutting down’ as such my shut down script does not work Is there anyway around it. I don’t need my server running 24/7 for no reason so it auto shuts down when not in use. At least it does with TN Core.

This is one horrible feature. Even trying to shut it down from putty it wants a reason. Interactive authentication required.

No, it wants you to authenticate, just like it says. truenas_admin doesn’t have rights to power off the server; that would need to be root.

But yes, it’s completely nonsensical (and I’m struggling to not use a stronger word) to mandate this and not allow the admin to bypass it.

I get the same request if I use the shell and I’m logged in as truenas_admin since root is almost no more. I thought truenas_admin is part of root.

I’m lost. ( 2 second Karen mode) It’s been over 2 years since I last looked at Scale and it is F**** horrible. Really really bad interface with everything everywhere. They really F*** this up. Why didn’t they adopt Cores layout. Anyway, 2 seconds over!

How do I console shutdown since using root is moot for it will eventually be scrapped from what I read.

I’m not sure why you would have thought that. You know about sudo, right?

Yeah. but (sorry I’ve been up for hours for this is only one of 5 other issues with this Scale testing) I never new how good TN core was until now.

U’mm, It’s a command, it’s intentional, not clicking on a button that you accidental press and shut-down. A less irritating method would be a 10 second time delay with the option to cancel.

How would I transfer it onto a script without having the password in plain text. There must be a way to bypass this. I don’t how long this ‘Feature’ has existed but I find it hard to accept that it’s accepted without being able to disable it.

Yes, and it’s a command that only root has permission to run. truenas_admin is not root, but can gain root permissions using sudo.

What script? And how are you running it? If it’s a cron job, that goes back to what I said earlier: run the script as root.

Accept what you like, but that’s the state of it as of now. There are open feature requests to change this behavior (or allow it to be disabled), but iX doesn’t care about the feature requests anyway. But if it makes you feel better, you can vote for one of them.

I’m going to step away for I have been at this for over 8 hours and have gotten no further than being able to import my disks. I’m glad I build a test unit first before trying to move to Scale. I need clean install not an upgrade.

With this I think part of confusion is that under users ‘root’ and ‘truenas_admin’ both have full admin rights.

To tired to care as I still haven’t resolved the main issue of dataset folder access.

Thanks for the time being.

The ambassador is a bit cryptic tonight as Vorlons are.

The tldr; is:

sudo shutdown -P now

when logged in to a shell as truenas_admin and you shall be enlightened.

Well, I’m assuming that anyone who’s got some kind of a script to shut down his server knows a thing or two about the *nix shell, which would include use of the sudo command. But subsequent responses in this thread suggest that this assumption is unwarranted.

In Core I have never had to use sudo for scripts or shut-down even as a user. For some reason I’m hitting brick walls with Scale. As I just tried to setup two Post Init scripts and keep getting permission denied, I dentical as I have it in Core. Which relate back to another post I place earlier regarding folder access. I imported all disks but cannot access folders or files.

CORE is not SCALE, in more ways than I care to describe, so “just like I did it in CORE” could very well be the wrong way to do it in SCALE. If you’d like to share specifics, it’s likely someone here can help.

To the question that’s the subject of this thread, once again, the command you’re using, if run as root, works just fine to shut down the server. A better command would be using the API as was previously noted up-thread: midclt call system.shutdown "whatever"–which can be run as the admin user.

1 Like

I have difficulty in explaining myself but I understand all that. Hear me out.
When I say as in Core I just mean shut down that’s it. For the script I use in core does not work in Scale due to a switch -o working in BSD but not in Linux so years ago in one of my first tests with Scale I found another shut down script and got it to work with Scale. All good, all sorted no issues. Then, not interested in Scale so put it aside.

Today Clean install of Scale and using disks from a core setup test disks lots of things not coming together. Especially permissions. I’ve had to delete and recreate datasets for nothing I did would allow me to access files. Back in 2022 everything was a breeze as I had non of these issues and no use for sudo. Yes things do change.

In any case, why the shut down script did not work is during setup I was test initiating from the shell to see for any errors but all I got was the authentication request making me believe I would need it when I use Cron, but once I set up Cron and used root it worked without issue. Confusion on my part, I should have just run it straight through cron without testing the script still works.

It’s done. Shuts down when no listed IP’s present all on its own.

Thanks for the help to all. I will try that midclt if I ever get to finish the rest.

Replaced </sbin/shutdown -P now> with < /usr/bin/midclt call system.shutdown now > in the script and all still works. That’s done.