auto shutdown/turnon

Status
Not open for further replies.

joppie908

Cadet
Joined
Feb 8, 2013
Messages
5
hello,

i just joined this forum couse im expirimenting with the FreeNas OS for my near future NAS system.
now i was looking around and trying to find a shell script for an auto shutdown and Turn on.
whilie i was looking for this i found this script:
#!/usr/bin/env python

from subprocess import Popen, PIPE
import os, sys

ip_list = []

###### IP addresses #####
# IP addresses go underneath this line, one on each line in the format: ip_list.append('x.x.x.x')

###### End IP addresses

shutdown = True

for ip in ip_list:
cmd = ['/sbin/ping', '-s 0', '-W 1', '-q', '-n' , '-c 1', ip]
p1 = Popen(cmd, stdout=PIPE, stderr=PIPE)
p1.wait()
statusText = p1.communicate()[0].split('\n')[3].strip()
if statusText.find(', 0.0% packet loss') > 0:
shutdown = False

if shutdown:
cmd = ['/sbin/shutdown', '-p', 'now']
p1 = Popen(cmd)

this seemed promissing till found out the only writing program i find to work (sort off) is VI now i dontk now how this works.
so here the ultimate question/suggestion:

Question:
is there a way to get this auto turn on/power off to get working?? (doest need to be IP based but that would be awsome)

Suggestion:
Make an auto configuration on the web GUI so people who dont need their NAS 24/7 that they can make it shutdown and turn on at certain times.

thx!!
joppie908

P.s plz don't pay to much atention to my spelling i know its horrible :P
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
First thing, you can use 'ee' for the text editor. I find it easier to use myself than VI and it's built in.

Second, I'm not sure what you are asking for. Do you want to control the FreeNAS server remotely to command it ON/OFF or have it take care of itself?

If you want it to take care of itself, create a cron job to shut down at the specified day/time. That was easy. As to get it to turn on, your computer BIOS may have a setting (timer) which will automatically power the computer on at a given time. Look in the power/boot section of the BIOS.

I personally can't help for remote turn on, such as wake-on-lan. Again that would be a BIOS thing with your motherboard.
 

joppie908

Cadet
Joined
Feb 8, 2013
Messages
5
thx for the info, yea i found the cron job fo auto poweroff. but im currently testing this in VMware so i dont rly know how to make it rurn on automaticly.
asfar for the auto wake-on-lan this was just and idea i think would be awsome.
 

Oliver

Cadet
Joined
Dec 30, 2014
Messages
1
I know this is an old post but it didn't look like there was an answer.
I turn my nas off after every use and my whole family uses the nas whenever they need it so I needed a solution for everyone.
I wrote a frontend with winbatch for everyone to use on their pc's but the two programs I call are free and could utilize a simple batch file.

I use a command line wake on lan program WOL.exe from http://www.gammadyne.com/cmdline.htm#wol
it's pretty simple to use "wol.exe macaddress"
Then to ssh to shut down freenas I use putty plink http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
commandline "plink -pw freenaspass root@homeserver poweroff"

It's not an automatic solution but this way the NAS only needs to stay on while we use it.
With 17 spinning disks I don't want the box running all day and night.
 
Status
Not open for further replies.
Top