Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 78 lines (66 sloc) 1.21 KB
#!/bin/bash
#
# Init script for mrepo distribution server.
#
# Written by Dag Wieers <dag@wieers.com>.
#
# chkconfig: 2345 90 10
# description: mrepo distribution server.
#
# processname: mrepo
# config: /etc/mrepo.conf
source /etc/rc.d/init.d/functions
[ -x /usr/bin/mrepo ] || exit 1
### Default variables
SYSCONFIG="/etc/sysconfig/mrepo"
MREPOCONFIG="/etc/mrepo.conf"
### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
[ -r "$MREPOCONFIG" ] || exit 1
RETVAL=0
prog="mrepo"
desc="rpm distribution server"
start() {
echo -n $"Starting $desc ($prog): "
mrepo -q -c $MREPOCONFIG
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
echo -n $"Shutting down $desc ($prog): "
mrepo -q --umount -c $MREPOCONFIG
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
reload)
reload
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
RETVAL=1
esac
exit $RETVAL