How do I start up a shell script when the system starts?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
The easiest way is to stick the script in /etc/rc.d/rc.local. Other that that, you put your script in /etc/rc.d/init.d and make the appropriate links to the runlevels you want the script to run in by liniking the script to the appropriate /etc/rc.d/rc*.d directory.
There are a number of places where that can be done. The right place to do it depends a lot on what the script is supposed to accomplish. If you could clarify that it would make it easier to give a good answer.
If what you want to do is something along the lines of starting up a service process then putting a properly structured script in /etc/init.d and setting up the appropriate links to it with chkconfig could be an option. Then you could specify which run levels you want the script to be executed for.
Another option is running it from /etc/rc.d/rc.local which is intended for system customization and runs after the /etc/init.d scripts. This may be important if your script is going to depend on something that the system startup scripts have launched.
Also, I assume you want it to start during boot up. If you wanted it to start on login that would be done differently.
For a GUI desktop, fedora normally boots to runlevel 5. For a text login like you typically have on a server, fedora boots to runlevel 3. As noted above, we need more details about what exactly you want to accomplish. Scripts launched from rc.local or init.d run with root privileges which may not be what you want.