Cover V11, I12
dec2002.tar

Listing 3 hawk.init.d.sample

$pidfile = "/var/run/hawk.pid";
#!/bin/sh

HAWK_HOME=/opt/hawk
HAWK_PID=/var/run/hawk.pid

case "$1" in

   start)
      echo "Starting hawk"
      $HAWK_HOME/daemon/hawk &
   ;;

   stop)
      echo "Shutting down hawk"
      if [ -f "$HAWK_PID" ];then
         kill `cat $HAWK_PID`
      fi
   ;;

   restart)
      echo "Restarting hawk"
      if [ -f "$HAWK_PID" ];then
         kill -HUP `cat $HAWK_PID`
      fi
   ;;

   *)
     /bin/echo "Usage: $0 {start|stop|restart}"
     exit 1
   ;;

esac
create database hawk;
use hawk;
create table ip (
   ip char(16) NOT NULL default '0',
   hostname char(255) default NULL,
   lastping int(10) default NULL,
   primary key  (ip),
   unique key ip (ip),
   key ip_2 (ip)
) type=MyISAM comment='Table for last ping time of hosts';
grant select,insert,update,delete
     on hawk.*
     to hawk@localhost
     identified by '<password>';
grant select,insert,update,delete
     on hawk.*
     to hawk@"%"
     identified by '<password>';
flush privileges;