File ypops.sh of Package ypops

#!/bin/sh
### BEGIN INIT INFO
# Provides:          YPOPS
# Required-Start:    $network
# Should-Start: 
# Required-Stop:     $network
# Should-Stop: 
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: YPOPS daemon for access to yahoo mail via pop/smtp
# Description:       Start ypops to allow receiving from and sending mail 
#    to your yahoo mail account with your favorite mail client.
#    Settings are maintained in /etc/ypops/ypops.conf
### END INIT INFO

YPOPS_LOG_DIR=/var/log/ypops
YPOPS_CONFIG_DIR=/etc/ypops/
YPOPS_BIN=/usr/sbin/ypops.bin

test -x $YPOPS_BIN || { echo "$YPOPS_BIN not installed"; 
    if [ "$1" = "stop" ]; then exit 0;
    else exit 5; fi; }

YPOPS_CONFIG=/etc/ypops/ypops.ini
test -r $YPOPS_CONFIG || { echo "$YPOPS_CONFIG not existing";
    if [ "$1" = "stop" ]; then exit 0;
    else exit 6; fi; }

. /etc/rc.status

rc_reset

case "$1" in
    start)
    echo -n "Starting ypops: "
    LAST_DIR=$PWD
    cd $YPOPS_CONFIG_DIR
	export YPOPS_CONFIG_DIR YPOPS_LOG_DIR
        $YPOPS_BIN &

        echo -n ` ps -C ypops -o pid `", "
    echo -n ` grep -A 0 SmtpPort= $YPOPS_CONFIG `", "
        echo -n ` grep -A 0 Pop3Port= $YPOPS_CONFIG `
        cd $LAST_DIR

    rc_status -v
    ;;
    stop)
    echo -n "Shutting down ypops: "

    /sbin/killproc -TERM $YPOPS_BIN

    rc_status -v
    ;;
    restart)
    $0 stop
    $0 start

    rc_status
    ;;
    status)
    echo -n "Checking for service ypops: "

    /sbin/checkproc $YPOPS_BIN

    rc_status -v
    ;;
    *)
    echo "Usage: $0 {start|stop|status|restart}"
    exit 1
    ;;
esac
rc_exit
openSUSE Build Service is sponsored by