c0der3d Posted December 1, 2011 Share Posted December 1, 2011 (edited) 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 December 1, 2011 by c0der3d Quote Link to comment Share on other sites More sharing options...
wcs Posted December 1, 2011 Share Posted December 1, 2011 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 Quote Link to comment Share on other sites More sharing options...
Ghostshell Posted December 1, 2011 Share Posted December 1, 2011 nice find, about to try and add this to my device and add a button on the advanced page so i can just click to shutdown Quote Link to comment Share on other sites More sharing options...
wcs Posted December 3, 2011 Share Posted December 3, 2011 nice find, about to try and add this to my device and add a button on the advanced page so i can just click to shutdown (putting my flame suit on) How hard is it to do this for a person that knows ZERO PHP? Quote Link to comment Share on other sites More sharing options...
itsm0ld Posted December 5, 2011 Share Posted December 5, 2011 nice find, about to try and add this to my device and add a button on the advanced page so i can just click to shutdown If you do get a little button setup I would be interested in it also =) Quote Link to comment Share on other sites More sharing options...
Darren Kitchen Posted December 7, 2011 Share Posted December 7, 2011 Cool, nice tip. Will see about adding this as a feature to the next version of the firmware. Cheers, Darren Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.