New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

How to power down via software?

Got problems with Bubba? Then this forum is for you.
Locked
csp
Posts: 6
Joined: 21 Mar 2008, 09:09

How to power down via software?

Post by csp »

Hi,

Is there any way of powering down a bubba by software at a fixed time each day? My initial thought was to put "shutdown -P now" in root's crontab, but that seems to put the machine into single user mode rather than powering off (i.e. I can still ping it!). Using "shutdown -h now" powers off the disk, but leaves the led blinking, and the network card active.

Thanks!
Colin
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Post by Cheeseboy »

Howdy Colin,

I have never tried it in a cron-job, but why not just use "poweroff" instead of shutdown?

Best regards,

Cheeseboy
csp
Posts: 6
Joined: 21 Mar 2008, 09:09

Post by csp »

Cheeseboy wrote:I have never tried it in a cron-job, but why not just use "poweroff" instead of shutdown?
That does the same as "shutdown -h": powers down the disk, but leaves the LED blinking and the main power on. I was hoping for something that would turn the machine off totally, like holding down the power button.

Cheers,
Colin
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Post by Cheeseboy »

Hi again,

Do you get the same result if you execute it manually as root?
If not, I'm afraid I'm out of my depth and cannot help you.

/Cheese
csp
Posts: 6
Joined: 21 Mar 2008, 09:09

Post by csp »

yeah, it works the same manually :-(
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Post by Cheeseboy »

Weird. Mine shuts down completely.
Perhaps we got different models...

I think this has to go to the Excito staff.

Cheers!

Cheeseboy
csp
Posts: 6
Joined: 21 Mar 2008, 09:09

Post by csp »

Following up on this, the web admin script in /usr/lib/web-admin/backend.pl has code to do a shutdown. The relevant part, as a shell script, is as follows:

Code: Select all

#!/bin/sh
MAGIC=/sys/devices/platform/buttons/bubbabuttons0/magic
if [ -e $MAGIC ]; then
        echo 19088743 >> $MAGIC
        /sbin/reboot
else 
        /sbin/poweroff
fi
Running this as a script from root's crontab seems to do a timed shutdown, although it's not exactly elegant.
tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Post by tor »

Hi,

I can give some background on how things work.

If you do a shutdown -h or a poweroff Linux inside bubba will try to do a complete shutdown and turn of power. The problem here is that there really is no way to cut power from software on bubba. So Linux will end up in an endless sleep in the end. And this is why leds and such is still enabled.

What happens when you press the powerbutton is that the driver in charge of this writes a "magic" value, 19088743 as csp noted ,in a ram located inside the CPU itself. And then issues a reboot insted.

What happens then is that the bootloader catches this on reboot. And instead of doing a reboot it shuts down the disk and waits for a new buttonpress to restart the system.

/Tor
Co-founder OpenProducts and Ex Excito Developer
Locked