aboutsummaryrefslogtreecommitdiffstats
path: root/packages/havp.sh
diff options
context:
space:
mode:
authorRajkumar S <raj@pfsense.org>2006-05-25 04:23:30 +0000
committerRajkumar S <raj@pfsense.org>2006-05-25 04:23:30 +0000
commit769c0a9a9e68d1a6931fae0cb7ba9e08cc71ceca (patch)
tree9178400b18904ecce6c525a341f5eee05ad4d19d /packages/havp.sh
parent83899d1ee712b427965ae76259d7e86046fc078b (diff)
downloadpfsense-packages-769c0a9a9e68d1a6931fae0cb7ba9e08cc71ceca.tar.gz
pfsense-packages-769c0a9a9e68d1a6931fae0cb7ba9e08cc71ceca.tar.bz2
pfsense-packages-769c0a9a9e68d1a6931fae0cb7ba9e08cc71ceca.zip
Start up script from Gary Buckmaster
Diffstat (limited to 'packages/havp.sh')
-rw-r--r--packages/havp.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/packages/havp.sh b/packages/havp.sh
new file mode 100644
index 00000000..5cc8c179
--- /dev/null
+++ b/packages/havp.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# HAVP Init script
+# 6/23/06 - Gary Buckmaster
+
+pidfile=/var/run/havp/havp.pid
+required_dirs=/var/tmp/havp
+required_files=/usr/local/etc/havp/havp.config
+
+
+rc_start()
+{
+ if [ ! -f $required_files ]
+ then
+ echo "FATAL: Missing HAVP config file: $required_files"
+ return
+ fi
+ if [ ! -d $required_dirs ]
+ then
+ echo "FATAL: Missing HAVP working director: $required_dirs"
+ return
+ fi
+ if [ -f $pidfile ]
+ then
+ pid=$(sed 's/ //g' $pidfile)
+ echo "FATAL: HAVP already running? pid: $pid"
+ return
+ else
+ echo "Starting HAVP Antivirus HTTP Proxy"
+ /usr/local/sbin/havp &
+ sleep 4
+ if [ -f $pidfile ]
+ then
+ pid=$(sed 's/ //g' $pidfile)
+ echo "Started pid: $pid"
+ else
+ echo "An error occurred starting HAVP"
+ return
+ fi
+ fi
+}
+
+rc_stop()
+{
+ pid=$(sed 's/ //g' $pidfile)
+ if [ ! -f $pidfile ]
+ then
+ echo "FATAL: HAVP already running pid: $pid"
+ return
+ else
+ echo "Stopping HAVP pid: $pid"
+ kill $pid
+ fi
+}
+
+case $1 in
+ start)
+ rc_start
+ ;;
+ stop)
+ rc_stop
+ ;;
+ restart)
+ rc_stop
+ sleep 5
+ rc_start
+ ;;
+esac
+