aboutsummaryrefslogtreecommitdiffstats
path: root/main/ruby-unicorn/unicorn.initd
blob: 228023cd3815df13227939ba273a5fb87b988845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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
}