#!/bin/bash # $Id$ #%rlevels: 3:s 4:s 5:s 0:k 1:k 2:k 6:k #%start: 90 #%stop: 20 #deps #%needs: #%before: #%after: source /etc/conf.d/rc source $rc_functions source /etc/conf.d/remserial checkconfig() { for i in REMOTE_HOST REMOTE_PORT STTY_OPTS DEVICE do if [[ -z $(eval echo \$${i}) ]] then rc_echo "Please set up /etc/conf.d/remserial proberly... aborted" exit 1 fi done } case "$1" in start) rc_print "Starting remote-serial daemon ..." checkconfig start-stop-daemon --quiet --start --exec /usr/bin/remserial \ --pidfile /var/run/remserial.pid --make-pidfile --background \ -- -r "${REMOTE_HOST}" -p "${REMOTE_PORT}" -s "${STTY_OPTS}" "${EXTRA_OPTS}" "${DEVICE}" evaluate_retval update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; stop) rc_print "Stopping remote-serial daemon ..." start-stop-daemon --quiet --stop --pidfile /var/run/remserial.pid evaluate_retval update_svcstatus $1 splash svc_stopped "$(basename $0)" 0 ;; restart) $0 stop sleep 1 $0 start ;; status) statusproc /usr/bin/remserial ;; *) rc_echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac