Need poweroff/shutdown

Status
Not open for further replies.

AlexF

Dabbler
Joined
Sep 12, 2011
Messages
16
Hi... new user here.
I need a method to poweroff/shutdown FreeNAS server on-demand - something less dangerous then logging-in via SSH or HTTP GUI using administrator account.
Surely there must be such functionality but I cannot find it anywhere.
Have I missed something in documentation?
Thanks, Alex
 

Durkatlon

Patron
Joined
Aug 19, 2011
Messages
414
Powering off a machine is usually restricted to privileged accounts. What did you have in mind instead of using either ssh or the GUI?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
You could write a crontab entry that would execute halt if a particular file was present. Run the crontab every few minutes (or every minute even). That would allow any user who had appropriate permissions to write the file to shut down your server. Script would be something vaguely along the lines of

#! /bin/sh -

if [ -f /mnt/tankname/dataset/directory/haltfile ]; then
rm /mnt/tankname/dataset/directory/haltfile
halt -p
fi

which can probably be massaged into something that can be crammed into the crontab without the need for a script file sitting somewhere. Check manpage for halt to see if I got the poweroff flag right.
 

marcusmarcus

Explorer
Joined
May 27, 2011
Messages
89
You could always walk up to it and push the power button, but you probably want to remotely shutdown.
 

AlexF

Dabbler
Joined
Sep 12, 2011
Messages
16
Thanks guys for responses.

Powering off a machine is usually restricted to privileged accounts. What did you have in mind instead of using either ssh or the GUI?

Easiest - a dedicated URI on current URL - it'd be enough for remote user to issue a request via wget.
More professional - via SNMP set.
 
Status
Not open for further replies.
Top