Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to start a process when our linux/unix boxes (These boxes are used as build agents) are starting (ie: after a reboot). We use the following distros:

  1. debian 6
  2. ubuntu 12.something
  3. FreeBSD
  4. CentOS 6
  5. Suse 12.something :)

Can you please let me know what should I make in order for this to happen?

Thank you, f.

share|improve this question
    
stackoverflow.com/questions/7221757/… –  rags Feb 27 '13 at 10:08

2 Answers 2

The easiest way would be to put your command in /etc/rc.d/rc.local. The rc.local script is run after all the other System V init script are done.

share|improve this answer

In general the same process should work for all those distro's but you might have to tweak them to suit their specific implementation.

Have a look at "run levels", determine at which level you want to start your scripts (usually 3 for a server and 3 & 5 for a graphical client) and then follow this:

http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/428743-how-run-script-startup.html

In a nutshell, you create your startup script (best copy and modify an existing one - for the sake of example call it "myScript") and place it in /etc/init.d. Then in /etc/init.d/rcX.d (where X is your run level) place links to the script you put in /etc/init.d. The links should be named SxxmyScript and KxxmyScript. The "S" links get followed on startup - i.e. when the system enters that runlevel, and the "K" links get executed when the system exits that runlevel.

More recent distributions use services which are a more elegant twist on the above, but the above should work.

Also, for completeness look at /etc/inittab. This isnt available on all distributions (i.e. ubuntu) but should be present on SuSE. This is a proper old throwback but is still very much used these days in older environments.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.