Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/sbin/runscript
- # Copyright 1999-2011 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
- # $Header: $
- DESCRIPTION="This utility is used to create a low cost home automation system controlled by computer"
- HOMEPAGE="http://openplacos.tuxfamily.org"
- SVCNAME="openplacos-server"
- USER=openplacos
- DAEMON=$(which ${SVCNAME})
- PIDFILE=/var/run/openplacos.pid
- CONFIGFILE=/etc/default/openplacos
- LOGFILE=/tmp/openplacos.log
- depend() {
- need dbus mysql
- after logger
- }
- checkconfig() {
- if [ ! -r ${CONFIGFILE} ]; then
- eerror "ERROR: Unable to read configuration file: ${CONFIGFILE}"
- return 1
- fi
- }
- checkprocess() {
- if [ $(ps ax | grep ${SVCNAME} | grep -v grep | wc -l) -eq 0 ]; then
- eerror "ERROR: Please, check logfile: ${LOGFILE}"
- return 1
- fi
- }
- start() {
- checkconfig || return $?
- ebegin "Starting openplacos"
- export RUBYOPT="rubygems"
- start-stop-daemon --start --user ${USER} --exec `dbus-launcher ${DAEMON}` \
- --pidfile ${PIDFILE} --make-pidfile --background --stdout ${LOGFILE}
- sleep 3
- checkprocess || return $?
- eend $? "Failed to start openplacos !"
- }
- stop() {
- ebegin "Stopping openplacos"
- start-stop-daemon --stop --quiet --user ${USER} --exec `dbus-launcher {DAEMON}` --pidfile ${PIDFILE}
- eend $? "Failed to stop openplacos !"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement