#!/bin/sh
#Made by Marcelo A.
#All Credits reserved to Marcelo A. nickname (Zap-W) , Copyrighted.
#
# cable                     This script starts or stops an CABLE connection
#
# description: Connects to CABLE provider
#
#
#. /etc/rc.d/init.d/functions  # For red hat?
. /etc/rc.config               # For SuSE, enables setting from /etc/rc.config

#Tweak this
restart_time=120


# Paths to programs
START=/usr/sbin/cable-start
STOP=/usr/sbin/cable-stop
STATUS=/usr/sbin/cable-status

test "$CABLE_START" = "yes" || exit 0

# The echo return value for success (defined in /etc/rc.config).
return=$rc_done
case "$1" in
    start)
        echo -n "Bringing up CABLE link"
        $START  > /dev/null 2>&1 || return=$rc_failed
        echo -e "$return"
        ;;

    stop)
        echo -n "Shutting down CABLE link"
        $STOP > /dev/null 2>&1 || return=$rc_failed
        echo -e "$return"
        ;;

    restart)
        $0 stop
        echo "Waiting" $restart_time "seconds for the host to reset itself"
        sleep $restart_time  #Note: Need time for host to reset itself
        $0 start
        ;;

    status)
        $STATUS
        ;;

    *)
        echo "Usage: cable {start|stop|restart|status}"
        exit 1
esac

exit 0
