#!/bin/bash # http://kaneda.bohater.net # Uruchamia / Zatrzymuje / Statusuje / Restartuje - dhcpd... 4 Slackware # # start|stop|status|restart ######################################################## DHCPD_ETHS="eth1 eth2 eth4" ################# startuj(){ if [ -z "`ps axuwwww|grep -w "dhcpd eth." |grep -v grep`" ] ; then dhcpd $DHCPD_ETHS echo "---::: [DHCPD] :::--- -> starting" else echo -e "ERROR: [DHCPD] - is running ... " fi } ######### stopuj(){ if [ ! -z "`ps axuwwww|grep -w "dhcpd eth." |grep -v grep`" ] ; then killall dhcpd echo "---::: [DHCPD] :::--- -> killed" else echo "---::: [DHCPD] :::--- -> is not running" fi } ######### status(){ JEST=`ps axuwwww|grep -v grep|grep -w "dhcpd eth." | awk -F "dhcpd" '{print $2'}` if [ ! -z "$JEST" ] ; then echo "[DHCPD] -> running on : $JEST" echo "OKOK" else echo "[DHCPD]: -> DOWN"; fi } ##### START ##### case "$1" in "stop") stopuj ;; "start") startuj ;; "status") status ;; "restart") stopuj startuj ;; * ) echo "Error: (start|stop|status|restart)" ;; esac