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 have nginx and postgresql daemons installed. How can make them start automatically every time server is started?

I think to add

sudo service nginx start
sudo service postgresql start

to ~/.profile but not sure if it's a good practice.

share|improve this question
up vote 1 down vote accepted

First list the service using chkconfig command

[root@localhost ~]# chkconfig --list | grep -i postgresql
postgresql-8.4  0:off   1:off   2:on    3:on    4:on    5:off   6:off

Suppose if you want to run postgresql automatically every time server is started

Then Try this command

[root@localhost ~]# chkconfig --level 5 postgresql-8.4 on

Here --level means in which runlevel you want to start(on) the service in my case it's runlevel 5

Do the same for other service also

After doing this servcie will automatically start when system boots.

share|improve this answer

Try doing this :

cd /etc/init
vim nginx*.conf

See mans :

init (5)             - Upstart init daemon job configuration
init (7)             - Upstart process management daemon
init (8)             - Upstart process management daemon

I mean :

man 5 init; man 7 init; man 8 init

found with :

man -k init | grep -o '^init (\w)'
init (5)
init (7)
init (8)
share|improve this answer

You must log in to answer this question.

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