summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2001-02-04 20:46:14 +0000
committertron <tron@pkgsrc.org>2001-02-04 20:46:14 +0000
commit634c6d3f293dc8bac28046cc0ecc94ffebb41355 (patch)
treebbbb89b564dd559089b2915803977fe57b6d5711 /www
parentfdb69bc253a7c71090e72c13159b9ef3dce34516 (diff)
downloadpkgsrc-634c6d3f293dc8bac28046cc0ecc94ffebb41355.tar.gz
Provide a new style startup script with backwards compatibility.
Diffstat (limited to 'www')
-rw-r--r--www/squid/files/squid.sh51
1 files changed, 22 insertions, 29 deletions
diff --git a/www/squid/files/squid.sh b/www/squid/files/squid.sh
index fee1eb9f513..ff6998198c5 100644
--- a/www/squid/files/squid.sh
+++ b/www/squid/files/squid.sh
@@ -1,35 +1,28 @@
#!/bin/sh
#
-# $NetBSD: squid.sh,v 1.5 2001/01/30 19:24:22 tron Exp $
+# $NetBSD: squid.sh,v 1.6 2001/02/04 20:46:14 tron Exp $
#
# REQUIRE: DAEMON
-case $1 in
-start)
- if [ `ps -auxwww | grep RunCache | grep -v grep | wc -l'` -ne 0 ]; then
- echo "squid already running."
- exit 1
- fi
+name="squid"
+command="@PREFIX@/sbin/${name}"
+required_files="/etc/squid.conf"
+command_args="-Y -f $required_files"
- 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
+if [ ! -d /etc/rc.d ]
+then
+ @ECHO@ -n ' ${name}'
+ exec ${command} ${command_args}
+fi
+
+. /etc/rc.subr
+
+extra_commands="reload"
+
+if [ "$1" = rotate ]
+then
+ exec ${command} -k rotate
+fi
+
+load_rc_config $name
+run_rc_command "$1"