Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As per this question, I'd like to start a /etc/init.d script on boot. I have the following script comments:

# Startup script for Wowza Media Server
#
# chkconfig: - 80 20
# description: Wowza Media Server is a media server
#
#### BEGIN INIT INFO
# Provides:          WowzaMediaServer
# Required-Start:    $syslog $time $local_fs $remote_fs
# Required-Stop:     $syslog $time $local_fs $remote_fs
# Default-Start:     3 4 5
# Default-Stop:      S 0 1 2 6
# Short-Description: Wowza Media Server 3 Init Script
# Description:       Wowza Media Server 3 Init Script
### END INIT INFO

I understand that for Debian and Ubuntu systems, rather than using chkconfig, I need to use update-rc.d. I've done this in the past, but it seems that update-rc.d just links the script to all runlevels. Is this really the case?

I need this script to only run when starting after networking is up; I'm running a script that needs to curl a URL in order to determine the public DNS name of the host (EC2). How can I add this script to auto-start using update-rc.d in the way I'm looking to do it?

share|improve this question
    
there's also nice sysv-rc-conf tool available for apt-get. –  anttir Nov 11 '11 at 16:16
    
In what way are you dissatisfied with what update-rc.d does? Yes, it links the script to all (normal) runlevels, so what? –  Gilles Nov 11 '11 at 23:51
    
If you really want it to run "after networking is up" you could just add it to /etc/network/if-up.d/ –  Sorpigal Nov 15 '11 at 13:02
    
@Gilles, sorry, I guess I don't really understand what runlevels are. –  Naftuli Tzvi Kay Nov 15 '11 at 20:43

2 Answers 2

up vote 2 down vote accepted

You should take into account that Debian and Ubuntu only use runlevels 0, 1, 2, 6, and the default graphical multiuser runlevel is 2.

Ubuntu has the added complication of upstart managing the event based services startup process, but old init.d script are still supported.

I think that the following command should work

update-rc.d script-base-name defaults

because, as you can see with the -n (dry run) option, it creates links whose names begin with S20 in runlevels 2, 3, 4, 5, the only meaningful being the 2, and I suppose the network is already started when the script will be executed.

If you want to be sure, you can add a greater sequence number, as in

update-rc.d script-base-name defaults 99

so that the links will be created with the S99 prefix, assuring the service is the last to be run.

share|improve this answer
1  
Runlevels 3, 4 and 5 exist, and you can customize them. It's just that by default, they are set up identically to runlevel 2. –  Gilles Nov 11 '11 at 23:51

I think you're looking for:

update-rc.d wowza start 99 2 3 4 5 .

share|improve this answer

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.