#!/bin/bash # # $Id: dhcprelay-RedHat.in,v 1.1.1.1 2002/08/20 08:42:03 sri Exp $ # # dhcprelay This starts and stops dhcprelay. # # chkconfig: 345 50 65 # description: System startup script for the DHCP-Relay # PATH=/sbin:/bin:/usr/bin:/usr/sbin # Source function library. . /etc/init.d/functions # Check for missing binaries (stale symlinks should not happen) DHCPRELAY_BIN=/usr/sbin/dhcprelay test -x $DHCPRELAY_BIN || { gprintf "Error: Program %s not found!\n" "$DHCPRELAY_BIN"; exit 5; } # Check for existence of needed config file and read it DHCPRELAY_CONFIG=/etc/dhcprelay.conf test -r $DHCPRELAY_CONFIG || { gprintf "Error: Can't open configuration file: %s!\n" "$DHCPRELAY_CONFIG"; exit 6; } . $DHCPRELAY_CONFIG # Reset return value RETVAL=0 start(){ gprintf "Starting dhcprelay: " # Need to get rid of localization for external services - # it doesn't make much sense to have i18n on the server side here LANG=en_US LC_TIME=en_US LC_ALL=en_US LC_MESSAGES=en_US LC_NUMERIC=en_US LC_MONETARY=en_US LC_COLLATE=en_US export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE unset HOME MAIL USER USERNAME daemon $DHCPRELAY_BIN $DEVICES $SERVERDEVICE $DHCPSERVER >> $LOGFILE & RETVAL=$? echo touch /var/lock/subsys/dhcprelay return $RETVAL } stop(){ gprintf "Stopping dhcprelay: " killproc $DHCPRELAY_BIN RETVAL=$? echo rm -f /var/lock/subsys/dhcprelay return $RETVAL } reload(){ stop start } restart(){ stop start } condrestart(){ [ -e /var/lock/subsys/dhcprelay ] && restart return 0 } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $DHCPRELAY_BIN ;; restart) restart ;; reload) reload ;; condrestart) condrestart ;; *) gprintf "Usage: %s {start|stop|status|restart|condrestart|reload}\n" "$0" RETVAL=1 esac exit $RETVAL