For example, I need to have the following script be executed on startup

service httpd start
service mysqld start
service sshd start
service pure-ftpd start
/usr/local/bin/noip2 start

I do NOT want to make an alias in the init.d folder for each and every program. Rather, can i make one text file to have all of these be called. That would be so much easier. Thank you!

  • 5
    You know there's a reason for those links in init.d. They allow the system to run the programs at startup but it ALSO shuts them down properly when the comp is being shut down. Jul 9, 2011 at 4:25
  • 1
    -1 There's reasons things are done the way they are. You're asking for trouble.
    – Chris S
    Jul 9, 2011 at 14:16

5 Answers 5


You don't need a script to startup te services. Under RedHat-based distributions (which is what it appears you are using), running this:

chkconfig servicename on

Will automatically create the symlinks for startup for the appropriate run levels (In this case (3 to 5). Under debian-based distributions, you would do

update-rc.d servicename defaults

To do the same thing. In fact, you can also reorder you start priorities with this tool as well:

update-rc.d servicename defaults 91

With upstart (which is what current version of Ubuntu is using and what Red Hat is moving to), you can even add dependancies so that one process will start only after a specific service is up. More info here:


At any event, if you don't want to use either of those mechanism, you can always use /etc/rc.local to start up your scripts. Unless there is a very good reason, just work with the tools that is already provided by your distro - it very likely better than what you can come up.


Create a script with your commands and then add a cron job with @reboot like so:

crontab -e

@reboot /path/to/script

  • Oh cool. I never knew that one. Fancy.
    – arkigos
    Jul 9, 2011 at 4:29

You can add those lines to /etc/rc.local. Note that it is run as 'root'.


You can just put a single script with each of those very commands in it in the init.d folder. I've done similar and it worked smashingly.

Flagged for move to Server Fault.


Make a bash script containing those commands and put it in the /etc/init.d/ directory.

Lets say you called it FOO. You then run

% update-rc.d FOO defaults

You also have to make the file you created, FOO, executable, using

$chmod +x FOO



  • He didn´t state he wanted to avoid the init.d directory entirely, just wanted to avoid creating a link for each one of the daemons
    – zad
    Jul 9, 2011 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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