Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

wondering how I can have a ruby script started at boot, as a particular user.

This is on centos, so I imagine i need to create a service. ?

share|improve this question
Is it going to be continuously running, or merely fired off and be done? – andol Jul 18 '10 at 15:26
up vote 0 down vote accepted

Read /usr/share/doc/initscripts-*/sysvinitfiles for information on writing the initscript that you'll need for this.

share|improve this answer

If you just want to run this script at boot time, put it in that user's crontab with the special time @reboot.

If the script is a long-running process that would normally keep running until you reboot, then a adding a service is the best solution.

share|improve this answer

Or u can add to /etc/rc.local somthing like this:

/usr/bin/sudo -u $user /path/to/script/script.rb

share|improve this answer
Or simply su -c /path/to/script/script.rb $user. – Gilles Jul 18 '10 at 16:36

Your Answer


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.