Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from logcabin/issue-74
Close #74: init script & RPM spec file
- Loading branch information
Showing
6 changed files
with
252 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/sh | ||
# | ||
# logcabin Startup script for logcabin | ||
# | ||
# chkconfig: - 85 15 | ||
# processname: logcabind | ||
# config: /etc/logcabin/logcabin.conf | ||
# config: /etc/sysconfig/logcabin | ||
# pidfile: /var/run/logcabin.pid | ||
# description: logcabin is clustered consensus deamon | ||
# | ||
### BEGIN INIT INFO | ||
# Provides: logcabin | ||
# Required-Start: $local_fs $remote_fs $network | ||
# Required-Stop: $local_fs $remote_fs $network | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: start and stop logcabin | ||
### END INIT INFO | ||
|
||
# Source function library. | ||
. /etc/rc.d/init.d/functions | ||
|
||
if [ -f /etc/sysconfig/logcabin ]; then | ||
# each daemon should have a variable myid defined here | ||
. /etc/sysconfig/logcabin | ||
fi | ||
|
||
prog=logcabin | ||
logcabin=${LOGCABIN-/usr/bin/logcabind} | ||
conffile=${CONFFILE-/etc/logcabin.conf} | ||
lockfile=${LOCKFILE-/var/lock/subsys/logcabin} | ||
pidfile=${PIDFILE-/var/run/logcabin.pid} | ||
DAEMON_COREFILE_LIMIT='unlimited' | ||
RETVAL=0 | ||
|
||
start() { | ||
echo -n $"Starting $prog: " | ||
daemon ${logcabin} --daemon --id ${myid} --config ${conffile} --log /var/log/${prog}.log --pidfile ${pidfile} | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL = 0 ] && touch ${lockfile} | ||
return $RETVAL | ||
} | ||
|
||
stop() { | ||
echo -n $"Stopping $prog: " | ||
killproc -p ${pidfile} ${prog} | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} | ||
} | ||
|
||
reload() { | ||
echo -n $"Reloading $prog: " | ||
killproc -p ${pidfile} ${prog} -HUP | ||
RETVAL=$? | ||
echo | ||
} | ||
|
||
configtest() { | ||
${logcabin} -t -c ${conffile} $FLAG | ||
RETVAL=$? | ||
return $RETVAL | ||
} | ||
|
||
rh_status() { | ||
status -p ${pidfile} ${logcabin} | ||
} | ||
|
||
# See how we were called. | ||
case "$1" in | ||
start) | ||
rh_status >/dev/null 2>&1 && exit 0 | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
rh_status | ||
RETVAL=$? | ||
;; | ||
restart) | ||
configtest || exit $RETVAL | ||
stop | ||
start | ||
;; | ||
condrestart|try-restart) | ||
if rh_status >/dev/null 2>&1; then | ||
stop | ||
start | ||
fi | ||
;; | ||
force-reload|reload) | ||
reload | ||
;; | ||
configtest) | ||
configtest | ||
;; | ||
*) | ||
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest}" | ||
RETVAL=2 | ||
esac | ||
|
||
exit $RETVAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters