Jump to content

Shutdown Your Pineapple The Right Way!


Recommended Posts

So all day today I was trying to get the shutdown call to work on my pineapple. It worked once and then all subsequent runs it failed to shutdown my pineapple. Pineapple would always reboot. I went around online and found the code for busybox and the shutdown code is still not perfect; if it cant shutdown it will do a reboot. The snippet is provided below.

I went looking for the rc call and found the way to turn off any linux device is to issue the following command:

root@Pineapple:/sbin# /etc/init.d/rcS K shutdown

How did I find the command? Like this :)

root@Pineapple:/sbin# cat /etc/inittab

::sysinit:/etc/init.d/rcS S boot

::shutdown:/etc/init.d/rcS K shutdown

tts/0::askfirst:/bin/ash --login

ttyS0::askfirst:/bin/ash --login

tty1::askfirst:/bin/ash --login

You can issue this command from console or web it works (under the advance tab). The Pineapple will shutdown immediately. Just give it a minute and all is good. I hope this helps a lot of you out there. Also, you can modify the advance.php code to issue this command if you want to :)

############ CODE FROM BUSYBOX ################

//TODO: I tend to think that signalling linuxrc is wrong

// pity original author didn't comment on it...

if (ENABLE_FEATURE_INITRD) {

/* talk to linuxrc */

/* bbox init/linuxrc assumed */

pid_t *pidlist = find_pid_by_name("linuxrc");

if (pidlist[0] > 0)

rc = kill(pidlist[0], signals[which]);

if (ENABLE_FEATURE_CLEAN_UP)

free(pidlist);

}

if (rc) {

/* talk to init */

if (!ENABLE_FEATURE_CALL_TELINIT) {

/* bbox init assumed */

rc = kill(1, signals[which]);

} else {

/* SysV style init assumed */

/* runlevels:

* 0 == shutdown

* 6 == reboot */

execlp(CONFIG_TELINIT_PATH,

CONFIG_TELINIT_PATH,

which == 2 ? "6" : "0",

(char *)NULL

);

bb_perror_msg_and_die("can't execute '%s'",

CONFIG_TELINIT_PATH);

}

}

} else {

rc = reboot(magic[which]);

Edited by c0der3d
Link to comment
Share on other sites

Do you really need to shut down the Pineapple this way?

I mean ... I will ... I don't know any better.

My question is, if it was important why hasn't it been placed in the quick set up guide or on the wifipineapple page.

Just say'n

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...