summaryrefslogtreecommitdiff
path: root/www/squid
diff options
context:
space:
mode:
authorhubertf <hubertf@pkgsrc.org>2000-12-16 09:45:44 +0000
committerhubertf <hubertf@pkgsrc.org>2000-12-16 09:45:44 +0000
commit32e7505da2d7eaf9ae9927ca845cbcc1129ab207 (patch)
tree303eeb45e80defaa3d281c3bfc4b811848554a9e /www/squid
parent13ba66975d695a1b1671999c13286cdb6b4afc43 (diff)
downloadpkgsrc-32e7505da2d7eaf9ae9927ca845cbcc1129ab207.tar.gz
Make this fit our rc.d start/stop scheme
Diffstat (limited to 'www/squid')
-rw-r--r--www/squid/files/squid.sh38
1 files changed, 31 insertions, 7 deletions
diff --git a/www/squid/files/squid.sh b/www/squid/files/squid.sh
index a904ce29d67..4ad5039e018 100644
--- a/www/squid/files/squid.sh
+++ b/www/squid/files/squid.sh
@@ -1,10 +1,34 @@
#!/bin/sh
#
-# $NetBSD: squid.sh,v 1.3 1998/12/06 12:42:00 tron Exp $
+# $NetBSD: squid.sh,v 1.4 2000/12/16 09:45:44 hubertf Exp $
#
-if [ -x @PREFIX@/sbin/RunCache -a -f /etc/squid.conf ];
-then
- @PREFIX@/sbin/RunCache >/dev/null 2>&1 &
- echo -n ' squid'
-fi
-exit 0
+
+case $1 in
+start)
+ if [ `ps -auxwww | grep RunCache | grep -v grep | wc -l'` -ne 0 ]; then
+ echo "squid already running."
+ exit 1
+ fi
+
+ if [ -x @PREFIX@/sbin/RunCache -a -f /etc/squid.conf ];
+ then
+ @PREFIX@/sbin/RunCache >/dev/null 2>&1 &
+ echo -n ' squid'
+ fi
+ ;;
+stop)
+ if [ `ps -auxwww | grep RunCache | grep -v grep | wc -l'` -ne 0 ]; then
+ kill `ps -auxwww | grep RunCache | awk '{print $2}'`
+ @PREFIX@/sbin/squid -k shutdown
+ else
+ echo "squid not running."
+ fi
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac