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 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
add comment

2 Answers

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
add comment

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
add comment

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.