Best method for automatic command execution every time a system boots up
I have a raspberry pi which I use without a monitor. I boot it up, connect to it via SSH, and then start a VNCserver on it. I have to do it every time I start the device or reboot it.
I would like to automate the process. Like in windows, I would add the vncserver to startup programs and it would automatically start every time the system boots up. I need to know how can I do this on raspbian wheezy. I tried to find a solution by googling but I wasn't able to successfully achieve what I wanted. Some websites talked about /etc/rc.local, some about crontab etc etc. As I am new to linux so I don't understand them. So I would love to know what is the best method to do it and then I would like to go deeper and understand the procedure. Thankx |
Add it to /etc/rc.local. Commands in this file will be executed after all other init scripts have completed.
|
Thanks @Kustom42
I added the following line to the /etc/rc.local file before the "exit 0" and it worked like a charm sudo vncserver :1 -geometry 1340x74 -depth -16 Taking advantage of this discussion, I would like to ask you "What is rc.local file?". I don't have much experience with Linux machines so I have to ask this noob question. |
The previous post basically explains it.
rc are run level scripts, you have a bunch of them that each service creates so it starts on boot. the rc.local is for custom commands and such you want executed after all the other rc scripts are. do some ls'ing on /etc/rc5.d/ http://www.tldp.org/LDP/sag/html/run-levels-intro.html |
|
I have always lamented that rc.local was not named rc.last
(RC = Run Control, IYI) |
Thanks @Kustom42, @chrism01 for the helpful links... I didn't grasp all of what was in those articles but at least now I know more than before reading those...
|
Quote:
|
lleb++ ... couldn't have put it better myself ;)
|
All times are GMT -5. The time now is 05:27 PM. |