Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am running a startup script to start iceweasel on bootup. it opens 2 tabs with pages for internal sites.
Only issue with the device is that it wont be rebooted correctly it has an on and off usb power supply that will kill the power.
I am wondering if there is anything that i can do or put in a startup location or a crontab that on any bootup after power cutting out that it stops the process and then restarts the process/webpages.
I assume the problem is caused by not doing an orderly shutdown before turning off power.
Without doing an orderly shutdown you could corrupt the SD card. When the pi boots you can create a file and delete on shutdown. If at boot time the file already exists then restart your process.
I assume the problem is caused by not doing an orderly shutdown before turning off power.
Without doing an orderly shutdown you could corrupt the SD card. When the pi boots you can create a file and delete on shutdown. If at boot time the file already exists then restart your process.
The issue i have is the environment the pi will be used in the people dont know how to use computers at all and they speak very little English. So i have an in-line power usb which powers it as if i had to get them to shut anything down it would require a mouse which they dont have as they use a scanner + keyboard combo.
I know turning them off like this can cause corruption on the cards but the cards are still cheaper than our current system which is about 10x the price of a pi itself. What sort of file would i put in the boot up? ive tried crontabs to try and find the process used by iceweasel then kill it before booting. but that hasn't seemed to work.
A better method might be to use CTRL-ALT-DEL keys
In the /etc/inittab file you should have something like:
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
If you change the -r to -h it will shutdown the PI when CTRL-ALT-DEL keys are pressed.
ill have a go at that, and see if it works. The only bit in startup in the /etc/init.d i have is @iceweasel--noerrdialogs --kiosk http://www.page-to.display
obviously i change the url but i will check it out and let you know if you it works or not
only issue is people will rather turn it off and back on than press buttons. ive tried to get them to do things before but i just want to try and get all angles covered
A better method might be to use CTRL-ALT-DEL keys
In the /etc/inittab file you should have something like:
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
If you change the -r to -h it will shutdown the PI when CTRL-ALT-DEL keys are pressed.
i have tried pressing those keys with the file changed, so it now looks like
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now but the pi is still online and doesnt turn off? any ideas?
Don't remember if you have to reboot for changes to take affect. I don't have a PI and so do not what happens when you just pull power. What happens i.e. does it do a file system check and then boots normally etc.
Checking to see if a file exists using rc.local and if it does reboots the PI if not create it (i.e touch myfile). You also need to add a script to delete that file with an orderly shutdown.
Don't remember if you have to reboot for changes to take affect. I don't have a PI and so do not what happens when you just pull power. What happens i.e. does it do a file system check and then boots normally etc.
Checking to see if a file exists using rc.local and if it does reboots the PI if not create it (i.e touch myfile). You also need to add a script to delete that file with an orderly shutdown.
I have rebooted a few times using sudo to make sure a proper reboot has been done. On boot it goes through the following folders
It would be nice to know what is causing the PI to not boot correctly. What steps are failing during the boot process? That might give us a better idea about what to do. Since no one else with a Pi has chimed in I'm assuming that rebooting again will fix the problem.
Add the following lines to the rc.local file.
Quote:
if [ -f /pf_test ]; then
# File exists reset
shutdown -r now
else
# create empty file and continue
touch /pf_test
fi
Quote:
#!/bin/bash
# /etc/init.d/norm_shutdown
### BEGIN INIT INFO
# Provides: normal shutdown
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 0 6
# Default-Stop:
# Short-Description:
# Description: This service is used to manage non orderly shutdown
### END INIT INFO
case "$1" in
start)
rm /pf_test
;;
stop)
;;
*)
echo "Usage: /etc/init.d/norm_shutdown start|stop"
exit 1
;;
esac
exit 0
To make the script executable
sudo chmod +x /etc/init.d/norm_shutdown
To make the script run at shutdown or reboot.
sudo update-rc.d /etc/init.d/servod defaults
It would be nice to know what is causing the PI to not boot correctly. What steps are failing during the boot process? That might give us a better idea about what to do. Since no one else with a Pi has chimed in I'm assuming that rebooting again will fix the problem.
Add the following lines to the rc.local file.
To make the script executable
sudo chmod +x /etc/init.d/norm_shutdown
To make the script run at shutdown or reboot.
sudo update-rc.d /etc/init.d/servod defaults
This is untested.
I had a thought yesterday of removing iceweasel again, reinstalling it but then going into the options by doing about:config and then whilst i was in there i was looking at different things and i was running through most of them rebooting and testing again until i found one section of the site which said sessionrestore from crash - which was set to true i changed that to false and a few others and now i dont seem to have the issue anymore, ive wrote the script anyway and ive stored it on my pi so if it comes back ill go down that route and ill see about running that in the startup boot file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.