#!/bin/sh

usage() {
    echo "Usage: john-cronjob [ install | remove ]"
}

if [ $# -ne 1 ];then
    usage
    exit 0
fi

case "$1" in
    remove)
        if [ -f /etc/cron.daily/john -a ! -L /etc/cron.daily/john ]; then
            rm /etc/cron.daily/john
        fi
        ;;
    install)
        if [ ! -e /etc/cron.daily/john -a ! -L /etc/cron.daily/john ]; then
            cp /usr/share/john/john-dailyscript /etc/cron.daily/john
            chmod u+x,og-rwx  /etc/cron.daily/john
        fi
        ;;
    *)
        usage
        exit 0
        ;;
esac
