Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
Hi all,
I would like to configure my server to automatically launch a script at boot up time (i.e. without the need to log in), but I got lost in services, session-managed and non-session-managed applications. Still, I'm confused about whether crontabs for each user become automatically active at boot up.
Could anybody help?
Last edited by zeroquaranta; 03-08-2010 at 05:05 AM.
Boot script organisation is distro-specific. Which distro are you using?
As long as crond is started at boot, it processes all the crontabs (unless it is started with a -d option with the wring directory). Use ps -ef | grep cron to see if it is running.
Generally you can accomplish this by calling your script from /etc/rc.local or putting a "@reboot command" entry in a user's crontab, but again it is distro-specific.
Ok. I'm using RHEL 5.4. Basically, my aim is to get my server "power cut proof", without the need to manually launch scripts (even though I know power cuts can always cause unpredictable things).
So, my understanding is that I probably have nothing to do for crontab.
As for automatically launch scripts, I will check the 'rc.local' thing to see if it works.
Just for curiosity, what about the "session-managed startup applications" ? It's applications associated to a specific user which gets automatically started when the user logs in (i.e. starts a session)?
Thanks!
Create a daemon script.
Use 'chkconfig --add <script_name>' to add the script.
Use 'chkconfig <script_name> on' to activate the script during the boot sequence (init levels and starting/closing order have to be defined in your script).
If you want to start the script immediately, then you can use service <script_name> start
Be aware that the daemon script has a header that has to be implemented correctly to make this to work. The script has to be in directory /etc/rc.d/init.d.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.