DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-10-19 19:58:16

random404
Member
Registered: 2011-10-17
Posts: 17

Safe to call /sbin/poweroff and /sbin/reboot directly?

I have set up passwordless ssh login to the DNS 323, and would like to be able to execute the following commands from my laptop when I'd like to shutdown or reboot the DNS 323:

ssh root@my-dns-device "/sbin/poweroff"

ssh root@my-dns-device "/sbin/reboot"

However, I wanted to ask whether it's safe to call these commands directly like this, or can it result in data corruption or other problems? (I use 2 standard volumes, no RAID. Though I may use any type of RAID in the future in this device.) Am I better off using a script to call the Shutdown and Restart commands from the web GUI? I've got something like this currently, but would like to call /sbin/poweroff and /sbin/reboot instead (if they're safe to call) because it's just cleaner and simpler.

Offline

 

#2 2011-10-19 20:45:37

rsd76
Member
Registered: 2010-04-18
Posts: 47

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

You can use them, but it will work like from the webinterface. Using cleanboot should work "cleaner".

See http://dns323.kood.org/howto:cleanboot

On my dns-323 with cleanboot /sbin/poweroff it is still a softlink to busybox.
halt/reboot/shutdown point to a new program from the cleanboot package: /usr/bin/do_reboot


Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin & Hobbes)

Offline

 

#3 2011-10-19 22:27:12

random404
Member
Registered: 2011-10-17
Posts: 17

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

Thanks for pointing me to cleanboot, I followed the instructions and enabled it. What is the difference between halt and shutdown? Searching about this for Linux in general says that it's better to call shutdown rather than halt... Is this the case for the DNS 323? As my shutdown command should I run:

ssh root@my-dns-device "/sbin/halt"

or

ssh root@my-dns-device "/sbin/shutdown"

Offline

 

#4 2011-10-20 13:58:42

rsd76
Member
Registered: 2010-04-18
Posts: 47

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

Not sure. On some unix systems one of the commands could just stop all without shutting everything down cleanly.
The other command shutsdown everything cleanly (like all executable scripts in /ffp/start/ are run with the stop argument).

With cleanboot it migth not matter. It might just do a clean shutdown.
Probably the shutdown is the best option...


Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin & Hobbes)

Offline

 

#5 2011-10-20 14:35:31

random404
Member
Registered: 2011-10-17
Posts: 17

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

Whether I do a halt, shutdown, or reboot, it actually takes about 4-5 minutes to actually execute this request, with no feedback that it's working (e.g. flashing lights). How long does it take before cleanboot initiates the reboot or shutdown from the time you send the command? I realize it's doing things 'cleanly' but that amount of time seems excessive.

If i disable cleanboot and use a script to shutdown the DNS 323 by accessing the web GUI, it takes just a few seconds. And I'm sure that wouldn't be corrupting the drives because it's a built in feature for shutting down and rebooting. So why the difference here, is it just my system?

Offline

 

#6 2011-10-21 10:46:36

rsd76
Member
Registered: 2010-04-18
Posts: 47

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

There are some sleep statements in the script cleanboot runs (/ffp/share/cleanboot/cleanboot.sh).
However is amount to just half a minute.

This script does stop all ffp programs via the executable scripts in /ffp/start/.
I just saw, that the script does not use reverse rcorder to execute them in the correct order.

Do all the programs in the /ffp/start dir, take al lot of time shutting down?

The firmware halt/poweroff do not take into account that that there might be programs running like /ffp.

I haven't stopped my dns cleanly lately. It have only be switch off lately by complete power loss (daughters and switches are a bad combination. smile ), but your poweroff time do seem large...


Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin & Hobbes)

Offline

 

#7 2011-10-22 02:55:30

random404
Member
Registered: 2011-10-17
Posts: 17

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

The scripts in /ffp/start don't seem to take too long to shut down. Something else must be going wrong and I can't tell what it might be.

I'm thinking I may need to reset my DNS 323 if nothing else works and reconfigure everything, maybe I screwed something up along the way. Now when I'm ssh'ed into the DNS 323 and I enter a simple 'reboot' or 'shutdown', literally nothing happens AT ALL... And then several minutes later my DNS 323 might or might not just shut down as though the request just went through. Has anyone dealt with anything like this and might know what might be going wrong here?

Offline

 

#8 2011-10-22 05:01:38

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

Add a bunch of echo statements to the scripts and/or setup a detailed log file with time stamps. That way you can see exactly what is going on and which statements take longer than others. Some processes take longer than others to "kill".

I had a nightly cleanup/check routine on one of my servers that would take over 20 minutes to run. After detailed logging, I was able to refine the process and now it takes less than 2 minutes.

Last edited by FunFiler (2011-10-22 05:03:59)


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#9 2011-10-22 14:19:20

rsd76
Member
Registered: 2010-04-18
Posts: 47

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

FunFiler,

This script is made so the disks in the system can be umount-ed cleanly.
Echo-ing all kind of info to a logfile on the disk is just something you do not want. Contraproductive. To a logfile in /tmp/ is also not usable.
This is cleaned or complety renewed at boot time.
Not sure how you could debug/trace in this case though.


Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin & Hobbes)

Offline

 

#10 2011-10-23 01:07:29

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

USB stick?


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#11 2011-10-23 11:03:55

rsd76
Member
Registered: 2010-04-18
Posts: 47

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

If you use /mnt/USB, this also gets umount-ed.


Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin & Hobbes)

Offline

 

#12 2011-10-24 17:46:32

random404
Member
Registered: 2011-10-17
Posts: 17

Re: Safe to call /sbin/poweroff and /sbin/reboot directly?

So then what options do I have for logging the script so I can see where it's taking its time? FunFiler, did you find a way to do this?

The 'reboot' command immediately shuts off all telnet and ssh connectivity and I can no longer connect to the drive I had mounted over cifs. But then after that moment passes I have no idea why it's taking it's time. All the lights on the device remain on (not even flashing) and it just sits that way...

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB