Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
sorna wrote:
Hi Rintje,
Thanks for all the information. Wonder if you can attach the version compiled for 25 sec time out. Seems I need a linux environment, if I want to compile myself.
Ok, see attachment.
Offline
Thanks a lot Rintje. It is working well. Appreciate your help.
Offline
Hey Sorna,
Just one more thing: while i was reconfiguring my NAS solution, the solution i described to you didn't work anymore for me. After some investigation i suddenly remembered that in the original working solution i also had to change the startup script /ffp/start/chkbutton2.sh. This modified startup script copies the chkbutton2 binary, backup.sh and cleanup.sh file to the hardware memory space, to prevent cleanup.sh from killing its own running process.
You said the solution already works for you, but for completeness of my solution i post the startup script here as well.
Offline
hello guys,
is there any chance that this script can be used to securely shutdown the DNS-323 with fw 1.08 (ffp + ups alone, no other fun scripts installed)?
i have been trying to find a solution for the shutdown when the UPS reaches the low battery state... until now without luck...
nothing seems to work (dns323-poweroff, poweroff, halt)
i thought of installing the cleanboot plugin but it seems that after install the only way to shutdown the NAS is by command line, the front button and web gui shutdown button wont work anymore...
any help would be very appreciated
thanks in advance!
Offline
I had a similar issue with NUT running as a client. I wanted the DNS-323 to shutdown after a period of time after the ONBATT warning came from the NUT server. (stupid cheap serial only UPS doesn't work directly on the DNS-323).
I tried chkbutton2, but this didn't seem to work when called from a script (upssched.cmd). Eventually I put together a bit of a kludge to get it all to work.
Firstly, you need to make sure all fun_plug bits are stopped, so the disks can spin down (unless you are running ffp from a USB stick - which I am not). The only way I could reliably get this to work was to remove chkbutton2 and use cleanboot to shutdown ffp, then touch /tmp/shutdown after a timer expires to "trick" the DNS-323 into shutting down. It may not matter, but I also found things worked better if I didn't use /ffp/bin/sh, but busybox bourne sh (i.e. /bin/sh).
So my upssched.cmd looks like:
#!/bin/sh
LOGFILE=/ffp/log/upssched.log
case $1 in
mainsoff)
echo "`date` Script ${0} started with option: ${1}" > $LOGFILE
echo "`date` Local Mains shutdown 90 seconds ago" >> $LOGFILE
echo "`date` ${0} System powerdown in 15 seconds!" >> $LOGFILE
/sbin/halt
sleep 15
touch /tmp/shutdown
;;
forcedshut)
echo "`date` Script ${0} started with option: ${1}" > $LOGFILE
echo "`date` UPS Monitor has requested immediate shutdown" >> $LOGFILE
echo "`date` ${0} performing system halt NOW!" >> $LOGFILE
/sbin/halt
sleep 5
touch /tmp/shutdown
;;
*)
echo "`date` Script ${0} started with invalid option: ${1}" > $LOGFILE
echo "`date` Script ${0} Stopping - no further action" >> $LOGFILE
;;
esac
It works for me, after many hours of testing and far too many reboots.....
The NUT config file upssched.conf also needs appropriate configuration to match the case statements above. e.g.
CMDSCRIPT /mnt/HD_a2/ffp/usr/local/ups/upssched-cmd
PIPEFN /mnt/HD_a2/ffp/var/state/ups/upssched/upssched.pipe
LOCKFN /mnt/HD_a2/ffp/var/state/ups/upssched/upssched.lock
AT ONBATT * START-TIMER mainsoff 90
AT ONLINE * CANCEL-TIMER mainsoff
AT LOWBATT * EXECUTE forcedshut
AT FSD * EXECUTE forcedshut
And the upsmon.conf file needs modification so that the various conditions trigger upssched too:
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT SYSLOG+EXEC
NOTIFYFLAG FSD SYSLOG+EXEC
I found that NUT has to run as root to make sure everything works ok, and make sure all the file paths exist!
Hope this helps.
Offline
@asluiter
Thx so much for your help!
Meanwhile i tried chkbutton2 and i found out that the poweroff2 command works great with my DNS-323.
*First problem was that after installing the chkbutton2 the HDs were not hibernating anymore .... and i noticed that strange cron job every 10 minutes (like reported above). Because of that i kept the chkbutton2 files installed but stopped it from starting, this way i can still trigger the poweroff2 command but the chkbutton2 is not running.
*Second problem: even without the chkbutton2 running the HDs wont still hibernate... and the front central squared led is allways on... not dimming...
so atm i don't know how to solve this problem... i thought that it would all be back normal after disabling chkbutton2 at at startup...
EDIT:
I spent an entire night with my laptop on and the HDs didnt hibernate. I turned off my laptop for 10 minutes and the HDs hibernated...
Aug 18 08:30:21 dns323 user.warn kernel: *************************************** Aug 18 08:30:21 dns323 user.warn kernel: * HD1 stand by now! * Aug 18 08:30:21 dns323 user.warn kernel: *************************************** Aug 18 08:35:21 dns323 user.warn kernel: Aug 18 08:35:21 dns323 user.warn kernel: *************************************** Aug 18 08:35:21 dns323 user.warn kernel: * HD0 stand by now! * Aug 18 08:35:21 dns323 user.warn kernel: *************************************** Aug 18 08:40:00 dns323 cron.notice crond[1687]: USER root pid 11418 cmd /usr/sbin/offl_chk two& Aug 18 08:50:01 dns323 cron.notice crond[1687]: USER root pid 11420 cmd /usr/sbin/offl_chk two& Aug 18 08:50:21 dns323 user.warn kernel: Aug 18 08:50:21 dns323 user.warn kernel: ####################################### Aug 18 08:50:21 dns323 user.warn kernel: # HD1 awake now ! # Aug 18 08:50:21 dns323 user.warn kernel: ####################################### Aug 18 08:50:26 dns323 user.warn kernel: Aug 18 08:50:26 dns323 user.warn kernel: ####################################### Aug 18 08:50:26 dns323 user.warn kernel: # HD0 awake now ! # Aug 18 08:50:26 dns323 user.warn kernel: #######################################
the font central squared led is allways on no matter what...
I also removed that cron job and it stoped bothering me every 10 minutes... i have no clue what it did
*/10 * * * * /usr/sbin/offl_chk two &
Last edited by oraitecamonyes (2010-08-18 11:31:46)
Offline
Hi, I have two questions.
in cleanup.sh there are references to cleanboot.conf and /ffp/share/cleanboot directory.
does this mean that they are required for chkbutton2?
second question is how custom scripts on shutdown is run.
i couldn't find any information describing them.
Offline
IK12 wrote:
Hi, I have two questions.
in cleanup.sh there are references to cleanboot.conf and /ffp/share/cleanboot directory.
does this mean that they are required for chkbutton2?
In my version of chkbutton2: yes. I incorporated cleanboot into the cleanup.sh script called by chkbutton2. This adds some more cleanup code, which fixes chkbutton2 in my situation.
IK12 wrote:
second question is how custom scripts on shutdown is run.
i couldn't find any information describing them.
If you place cleanup.sh and/or backup.sh in the same dir as the chkbutton2 executable, then thechkbutton2 will run these scripts on shutdown. In my solution, cleanup.sh is already there to do the cleanboot stuff you found.
HTH
Offline
so i should install cleanboot too?
if, for instance, i made a script called abc.sh and put it in the same folder as the chkbutton2 executable, would the new script be run on shutdown?
Offline
IK12 wrote:
so i should install cleanboot too?
Yes. (chkbutton2 does NOT do this for you)
IK12 wrote:
if, for instance, i made a script called abc.sh and put it in the same folder as the chkbutton2 executable, would the new script be run on shutdown?
That's the idea indeed, but the file has to be named 'cleanup.sh' or 'backup.sh' literaly. 'abc.sh' won't work.
Offline
what if i want to sync data from the harddrive to an external usb harddrive before shutdown using rsync?
would i just add a line to cleanup.sh?
Offline
Theoretically yes, but there may be a problem with the timeout of chkbutton2 being to short. Chkbutton2 does not wait until the scripts exits.
The original chkbutton2 will continue shutdown after 5 seconds. I increased that number to 25 seconds in my version. You need a recompile to make it even higher.
Offline
Hi !
I have DNS-323 rev-B, fw-1.09 with installed "chkbutton2" from #18 post. "chkbutton2" work good. But in Web page DNS-323 command "restart" work correctly, and command "shutdown" work NOT correctly, DNS-323 is not switched off. In telnet commands "poweroff2" and "reboot2" work good. If do "chkbutton2 stop", and then "chkbutton2 start", command "shutdown" in Web page not work too. I reinstall "chkbutton2" with "rintje" files from #51, #53 posts. Has changed nothing. What have I made incorrectly? Whether there is a problem decision?
Thanks.
p/s
DNS-323 rev-A dont work correctly in Web page too :-(
Last edited by gattor (2011-02-15 20:22:26)
Offline