aboutsummaryrefslogblamecommitdiffstats
path: root/main/ruby-unicorn/unicorn.initd
blob: 228023cd3815df13227939ba273a5fb87b988845 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12




                                  
 





                      
         


                                 
                                           
                                  
                                   



               
                                 







                                  
                               




                                         





                                                            
#!/sbin/runscript

gem_path=$(gem env gemdir)
name="unicorn_rails"
start_script="$gem_path/bin/$name"

depend() {
        use logger dns
        need net
        after firewall
}

start() {
        checkconfig || return 1

	ebegin "Starting unicorn"
        start-stop-daemon --start --quiet \
                $start_script -- \
                -D -E $ENV -c $CONF
        eend $?
}

stop() {
        ebegin "Stopping unicorn"
        start-stop-daemon --stop \
                --name $name
        eend $?
        sleep 1
}


reload() {
        ebegin "Reload unicorn"
        start-stop-daemon --signal USR2 \
                 --name $name
        eend $?
}

checkconfig() {
	if [ -z "$CONF" ]; then
		eerror "No configuration file set in confd!"
		return 1
	fi
}