mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-18 22:06:04 +01:00
0499dcf219
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
54 lines
775 B
Bash
54 lines
775 B
Bash
#!/bin/sh
|
|
#
|
|
# DBMail-imapd startup script for Slackware Linux
|
|
|
|
SERVICE='/usr/sbin/dbmail-imapd'
|
|
OPTS=''
|
|
PIDDIR='/var/run/dbmail'
|
|
PID="${PIDDIR}/dbmail-imapd.pid"
|
|
USER='mail'
|
|
GROUP='mail'
|
|
|
|
service_start() {
|
|
if [ ! -d "$PIDDIR" ]; then
|
|
mkdir "$PIDDIR"
|
|
chown ${USER}:${GROUP} "$PIDDIR"
|
|
fi
|
|
|
|
if [ -f "$PID" ]; then
|
|
echo "PID-file exist, refusing to run ${SERVICE}."
|
|
exit 1
|
|
fi
|
|
|
|
$SERVICE "$OPTS"
|
|
}
|
|
|
|
service_stop() {
|
|
if [ -f "$PID" ]; then
|
|
kill $(< $PID)
|
|
else
|
|
echo "No PID-file at $PID found, quitting."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
service_restart() {
|
|
service_stop
|
|
sleep 1
|
|
service_start
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
service_start
|
|
;;
|
|
stop)
|
|
service_stop
|
|
;;
|
|
restart)
|
|
service_restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|