Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Thu Apr 19, 2018 8:15 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Aug 31, 2010 11:02 am 
Offline
Newbie

Joined: Fri Jun 08, 2007 9:32 am
Posts: 28
I justed wanted to let you know, how I realized my custom sleep with the Linkstation Pro (V1). It is a simple ping-solution (check your firewall rules all of your devices!!!), because there is not any "netstat" command available at Linkstation Pro (V1) --> http://forum.buffalo.nas-central.org/viewtopic.php?f=37&t=21982. Also I do not use any torrent or usenet client on my box, which affords my nas to be running. But I think you could also develop my script further on, if someone should need such a feature (e.g. check if a process is running via the ps command).

Code:
#!/bin/sh

################################################################################
#
# CUSTOM_STANDBY                                               by tommac 2010-08-31
#
################################################################################

# This cron-job is intended to be used as a additional featute for the provided standby-
# mechanism from buffalo. It checks specific ip adresses and only if all of
# the listet ip adresses do not give a valid ping back it will put the link-
# station into standby.

# TODO: test resume function with this script

CHKIP1=1.2.3.4
CHKIP2=5.6.7.8
#CHKIP3=<3. zu überprüfende IP Adr.>

# Anzahl anzupingender IP-Adressen
COUNT_CHKIP=2

# Defaultwert für nicht pingbare Endgeräte = down
DEVICES_DOWN=0

# Defaultwert für Schleifenzähler
i=0

# Defaultwert für Standby aus = 0
DOSTANDBY=0

# Funktion für Standbyaufruf
dostandby () {
#/usr/local/bin/standby_check.sh
/usr/local/sbin/PowerSave.sh standby
}

# ToDo: Ggf. automatischer resume, falls bestimmte Geräte wieder erreichbar
#doresume () {
#/usr/local/sbin/PowerSave.sh resume
#}

# ping CHKIP1
if [ $DOSTANDBY -eq 0 ]; then
   ping -c 1 $CHKIP1
   if [ $? -eq 1 ]; then
   (( DEVICES_DOWN++ ))
   #echo $DEVICES_DOWN
   fi
fi

# ping CHKIP2
if [ $DOSTANDBY -eq 0 ]; then
   ping -c 1 $CHKIP2
   if [ $? -eq 1 ]; then
   (( DEVICES_DOWN++ ))
   #cho $DEVICES_DOWN
   fi
fi

## ping CHKIP3
#if [ $DOSTANDBY -eq 0 ]; then
#   ping -c 1 CHKIP3
#   if [ $? -eq 1 ]; then
#   (( DEVICES_DOWN++ ))
#   #cho $DEVICES_DOWN
#   fi
#fi

# Wenn Anzahl inaktiver Geäte gleich der Gesamtzahl angegebener Geräte --> standby
if [ $DEVICES_DOWN == $COUNT_CHKIP ] ; then
dostandby
#echo "dostandby"
DOSTANDBY=1
fi


A short description for setting everything up (running the script every 5 minutes via cron):
  • Copy the code into a textfile (e.g. custom_standby.sh)
  • Move this file onto your LS
  • Telnet/SSH to your LS (you need root-access)
  • Move the file into the /etc/cron/cron.d/ directory, e.g.
    Code:
    mv /mnt/array1/share/custom_standby.sh /etc/cron/cron.d/
  • Change owner to root and allow execution of this file
    Code:
    chown root:root /etc/corn/cron.d/custom_standby.sh
    chmod a+x /etc/cron/cron.d/custom_standby.sh
  • Add the following line into /etc/cron/crontabs/root:
    Code:
    */5 * * * * /etc/cron/cron.d/custom_standby.sh
  • Restart cron-deamon with
    Code:
    /etc/init.d/cron.sh restart
  • Check if the new job is listed via the command "crontab -l". If everything is o.k. you should get some output like below
    Code:
    root@LinkStation:~# crontab -l
    00 0 * * * /etc/cron/cron.d/mailnotice.sh
    05 4 * * * /etc/cron/cron.d/logrotate
    08 4 * * * /etc/cron/cron.d/calib_time.sh
    26 22 */1 * * /etc/cron/cron.d/ntpdate
    00 8 * * * /usr/local/bin/change_notify.sh led_wakeup
    00 23 * * * /usr/local/bin/change_notify.sh led_sleep
    00 07 * * * /usr/local/sbin/PowerSave.sh resume-cron
    00 08 * * * /usr/local/sbin/PowerSave.sh standby-cron
    */5 * * * * /etc/cron/cron.d/custom_standby.sh


Top
   
PostPosted: Tue Oct 19, 2010 5:16 am 
Offline
Newbie

Joined: Thu Apr 10, 2008 5:39 pm
Posts: 73
Location: HK
Can Linkstation wake up when IP1 or IP2 is up again or have to push the Linkstation power button manually?

_________________
LinkStation Live V2, Stock Firmware: 1.20-0.76 Japan w/EXT3 root-fs & JFS Data Partitions


Top
   
PostPosted: Wed Mar 02, 2011 1:23 pm 
Offline
Newbie

Joined: Fri Jun 08, 2007 9:32 am
Posts: 28
You can resume your box, if you call http://<Linkstation-IP>/cgi-bin/resume.cgi via your browser or any other way to call a URL (wget, curl, ...)


Top
   
PostPosted: Tue Jan 08, 2013 10:37 pm 
Offline
Newbie

Joined: Fri Nov 30, 2012 7:55 am
Posts: 6
My LS-GL doesn't have the file, "PowerSave.sh". Where did you get that file from?
If it is a custom file, can you supply that to me? Any other non-standard files would also be greatly appreciated.

Thanks.


Top
   
PostPosted: Tue Feb 04, 2014 4:21 pm 
Offline
Newbie

Joined: Fri Jun 08, 2007 9:32 am
Posts: 28
@averagemale: Just came here back after a long time. Is your question still relevant?

As long as I can remember the file PowerSave.sh is created by the system itself just at that moment, the linkstation fells into sleep...


Top
   
PostPosted: Fri Jul 11, 2014 10:32 pm 
Offline
Newbie

Joined: Fri Jul 11, 2014 9:34 pm
Posts: 5
In which "state" of sleep the linkstation is turning into?

Just think about how to don't let my HD spin all the time while the system is placed on an external usb stick anyway...

Any idea how to control the sleep of the HD and just turn on for file access?

Good night! 8-)


Top
   
PostPosted: Wed Jul 16, 2014 8:55 am 
Offline
Newbie

Joined: Tue Jun 11, 2013 11:28 am
Posts: 30
Hi,

can anyone please upload or send the resume.cgi file to me?

Thank you.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited