ALT Linux repositórios
Group :: Sistema/Servidores
RPM: mathopd
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
#!/bin/sh
#
# chkconfig: - 90 10
# description: A fast HTTP server.
# processname: mathopd
# config: /etc/mathopd.conf
# pidfile: /var/run/mathopd.pid
# Source function library.
. /etc/init.d/functions
# Overridable options
RELNAME="${0##*/}"
PIDFILE="/var/run/$RELNAME.pid"
LOCKFILE="/var/lock/subsys/$RELNAME"
EXPECT_USER=
CONFIG_FILE=
# Try to override default options by service profile
SourceIfExists /etc/sysconfig/$RELNAME
# Fixed-value options
NAME="mathopd"
BINPATH="/usr/sbin/$NAME"
# Calculated options
[ -z "$CONFIG_FILE" ] && CONFIG_FILE="/etc/$RELNAME.conf"
[ -r "$CONFIG_FILE" ] || CONFIG_FILE="/etc/$NAME.conf"
[ -z "$EXPECT_USER" ] && \
EXPECT_USER="$(grep -w '^[ \t]*User[ \t]*' ""$CONFIG_FILE"" | awk '{print $2;}' | tail -1)"
[ -z "$EXPECT_USER" ] && \
EXPECT_USER="$RELNAME"
id -un "$EXPECT_USER" >/dev/null 2>&1 || \
EXPECT_USER="$NAME"
# Internal variables
COMMON_OPTS="--pidfile $PIDFILE --lockfile $LOCKFILE --expect-user $EXPECT_USER"
RETVAL=0
#-----------------------------------------------
start() {
start_daemon $COMMON_OPTS -- $NAME -f "$CONFIG_FILE"
RETVAL=$?
return $RETVAL
}
stop() {
[ -n "$2" ] && echo -n "$2"
stop_daemon $COMMON_OPTS "$1" -- $NAME
RETVAL=$?
return $RETVAL
}
restart() {
stop
start
}
safestop() {
stop -USR2 "Safe stopping $NAME (waiting for all connections to finish..)"
}
saferestart() {
safestop
start
}
reload() {
msg_reloading $NAME
stop_daemon $COMMON_OPTS -HUP -- $NAME
RETVAL=$?
return $RETVAL
}
main() {
case "$1" in
start) start ;;
stop) stop ;;
reload) reload ;;
restart) restart ;;
safestop) safestop ;;
saferestart) saferestart ;;
condstop) [ -e "$LOCKFILE" ] && stop ;;
condrestart) [ -e "$LOCKFILE" ] && restart ;;
condreload) [ -e "$LOCKFILE" ] && reload ;;
condsaferestart)
[ -e "$LOCKFILE" ] && saferestart ;;
drop) stop -USR1 "Drop all currently established connections for $NAME" ;;
reap) stop -CHLD "Reape all children for $NAME" ;;
debug) stop -QUIT "Switch debugging mode on/off for $NAME" ;;
status) status $COMMON_OPTS -- $NAME
RETVAL=$?
;;
*) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
RETVAL=1
esac
return $RETVAL
}
main "$@"
## EOF ##