Super User is a question and answer site for computer enthusiasts and power users. 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

I am using CentOS 6.3, I failed to add a script in inittab to let it start automatically.

myscriptid:2345:respawn:myscript_path

In the script, I have a su myusername -c command, if I run it directly, it prompts me to enter the password, then the script can run. So my question is if I add it to inittab, will it be called successfully?

share|improve this question

migrated from serverfault.com Dec 17 '12 at 19:07

This question came from our site for system and network administrators.

First, accepted practice is to never run an initialization script outside the standard /etc/init.d (or the newer startup methods) unless it is absolutely necessary.

Why not create a script, put it in /etc/init.d with appropriate symbolic links to /etc/rc.5 or /etc/rc.3 (as appropriate) for starting and stopping such a service. The service command calls scripting in /etc/init.d.

So please reconsider reconstructing your startup scripting.

Now for the specific answer, if the scripting you have runs as the root user, then any su will not require a password.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .