aboutsummaryrefslogblamecommitdiffstats
path: root/main/gross/grossd.initd
blob: 611a95e6f2e1d77c111b97bbe692d15d3931aa5d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                  


                        

                    
                                


                
                      




                                                    

                                                                            




                                
                                                               
                                 
                                                                
                                     
                                                       




                                 
                                                 


               
#!/sbin/openrc-run

NAME="grossd"
DAEMON="/usr/sbin/$NAME"
DAEMON_USER="gross"
DAEMON_GROUP="gross"
pidfile=/var/run/gross/$NAME.pid

depend() {
	need net
	after firewall
}

check_config() {
	if [ ! -f /var/db/gross/state ] ; then
		einfo "Generating Gross database..."
		install -dD -o${DAEMON_USER} -g${DAEMON_GROUP} /var/db/gross
		${DAEMON} -Cu ${DAEMON_USER} > /dev/null
	fi
}

start() {
	check_config || return 1
	checkpath --directory --owner gross:gross ${pidfile%/*}
	ebegin "Starting ${NAME}"
	start-stop-daemon --start --quiet --pidfile ${pidfile} \
		--exec ${DAEMON} -- \
		-p ${pidfile} -u ${DAEMON_USER} ${OPTS}
	eend $?
}

stop() {
	ebegin "Stopping ${NAME}"
	start-stop-daemon --stop --exec ${DAEMON}
	eend $?
}