From 43f818559273e1266d4a38327f9aed98638aa1b7 Mon Sep 17 00:00:00 2001 From: rhatto Date: Wed, 13 Sep 2006 21:21:39 +0000 Subject: privoxy: initscript fix git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@184 370017ae-e619-0410-ac65-c121f96126d4 --- privoxy/privoxy.SlackBuild | 3 ++ privoxy/rc.privoxy | 105 --------------------------------------------- privoxy/rc.privoxy.new | 105 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 105 deletions(-) delete mode 100755 privoxy/rc.privoxy create mode 100755 privoxy/rc.privoxy.new (limited to 'privoxy') diff --git a/privoxy/privoxy.SlackBuild b/privoxy/privoxy.SlackBuild index d02d2cf8..3862d17f 100755 --- a/privoxy/privoxy.SlackBuild +++ b/privoxy/privoxy.SlackBuild @@ -80,6 +80,9 @@ fi find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +mkdir -p etc/rc.d +cp $CWD/rc.privoxy.new etc/rc.d + mkdir install cat << EOF > install/slack-desc # HOW TO EDIT THIS FILE: diff --git a/privoxy/rc.privoxy b/privoxy/rc.privoxy deleted file mode 100755 index f391d40d..00000000 --- a/privoxy/rc.privoxy +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -# ******************************************************************** - -RETVAL=1 - -PRIVOXY_PRG="privoxy" -PRIVOXY_BIN="/usr/sbin/$PRIVOXY_PRG" -PRIVOXY_CONF="/etc/privoxy/config" -PRIVOXY_USER="privoxy" -PRIVOXY_GROUP="privoxy" -PRIVOXY_PID="/var/run/$PRIVOXY_PRG"/$PRIVOXY_PRG.pid - -declare -i check -check=(`/bin/ps -e|/bin/grep $PRIVOXY_PRG|/usr/bin/wc -l`) - -# some checks for us -if [ ! -x $PRIVOXY_BIN ] ; then exit 0 ;fi -if [ ! -f $PRIVOXY_CONF ] ; then exit 0 ;fi - -# See how we were called. - -PRIVOXY="$PRIVOXY_BIN $PRIVOXY_CONF" - -start () { - # start daemon - echo -n $"Starting $PRIVOXY_PRG: " - - if [ ! -f $PRIVOXY_PID ]; then - ($PRIVOXY --user $PRIVOXY_USER.$PRIVOXY_GROUP --pidfile $PRIVOXY_PID -c $PRIVOXY_CONF 2>/dev/tty9 ) \ - && echo " OK" \ - && /bin/touch /var/lock/$PRIVOXY_PRG \ - && RETVAL=0 - elif [ $check -lt 3 ]; then - echo "Zombie lock file found" - /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID - echo "Retrying..." - start - else - echo "Already running" - fi - echo -} - -stop () { - # stop daemon - echo -n $"Stopping $PRIVOXY_PRG: " - if [ -f $PRIVOXY_PID ]; then - /bin/kill `/bin/cat $PRIVOXY_PID` \ - && /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID \ - && echo " OK" \ - && RETVAL=0 - echo - else - echo " Not Running" - fi -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - reload) - if [ -f $PRIVOXY_PID ] ; then - /bin/kill -HUP `cat $PRIVOXY_PID` \ - && RETVAL=0 - fi - ;; - restart) - stop - start - ;; - kill) - echo "Kill all Privoxy" - /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID - /bin/killall $PRIVOXY - ;; - condrestart) - # restart only if already running - if [ -f $PRIVOXY_PID ] ; then - stop - start - fi - ;; - status) - /bin/ps ax|/bin/grep $PRIVOXY_PRG|/bin/grep -v 'grep\|init\.d\|rc\.d' - RETVAL=0 - ;; - top) - if [ -f $PRIVOXY_PID ]; then - a="" - for i in `/sbin/pidof $PRIVOXY_PRG` ; do - a="$a -p $i" - done - /usr/bin/top $a - fi - ;; - *) - echo $"Usage: $PRIVOXY_PRG {start|stop|reload|restart|condrestart|status|top|kill}" - exit 1 -esac - -exit $RETVAL diff --git a/privoxy/rc.privoxy.new b/privoxy/rc.privoxy.new new file mode 100755 index 00000000..f391d40d --- /dev/null +++ b/privoxy/rc.privoxy.new @@ -0,0 +1,105 @@ +#!/bin/sh +# ******************************************************************** + +RETVAL=1 + +PRIVOXY_PRG="privoxy" +PRIVOXY_BIN="/usr/sbin/$PRIVOXY_PRG" +PRIVOXY_CONF="/etc/privoxy/config" +PRIVOXY_USER="privoxy" +PRIVOXY_GROUP="privoxy" +PRIVOXY_PID="/var/run/$PRIVOXY_PRG"/$PRIVOXY_PRG.pid + +declare -i check +check=(`/bin/ps -e|/bin/grep $PRIVOXY_PRG|/usr/bin/wc -l`) + +# some checks for us +if [ ! -x $PRIVOXY_BIN ] ; then exit 0 ;fi +if [ ! -f $PRIVOXY_CONF ] ; then exit 0 ;fi + +# See how we were called. + +PRIVOXY="$PRIVOXY_BIN $PRIVOXY_CONF" + +start () { + # start daemon + echo -n $"Starting $PRIVOXY_PRG: " + + if [ ! -f $PRIVOXY_PID ]; then + ($PRIVOXY --user $PRIVOXY_USER.$PRIVOXY_GROUP --pidfile $PRIVOXY_PID -c $PRIVOXY_CONF 2>/dev/tty9 ) \ + && echo " OK" \ + && /bin/touch /var/lock/$PRIVOXY_PRG \ + && RETVAL=0 + elif [ $check -lt 3 ]; then + echo "Zombie lock file found" + /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID + echo "Retrying..." + start + else + echo "Already running" + fi + echo +} + +stop () { + # stop daemon + echo -n $"Stopping $PRIVOXY_PRG: " + if [ -f $PRIVOXY_PID ]; then + /bin/kill `/bin/cat $PRIVOXY_PID` \ + && /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID \ + && echo " OK" \ + && RETVAL=0 + echo + else + echo " Not Running" + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + reload) + if [ -f $PRIVOXY_PID ] ; then + /bin/kill -HUP `cat $PRIVOXY_PID` \ + && RETVAL=0 + fi + ;; + restart) + stop + start + ;; + kill) + echo "Kill all Privoxy" + /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID + /bin/killall $PRIVOXY + ;; + condrestart) + # restart only if already running + if [ -f $PRIVOXY_PID ] ; then + stop + start + fi + ;; + status) + /bin/ps ax|/bin/grep $PRIVOXY_PRG|/bin/grep -v 'grep\|init\.d\|rc\.d' + RETVAL=0 + ;; + top) + if [ -f $PRIVOXY_PID ]; then + a="" + for i in `/sbin/pidof $PRIVOXY_PRG` ; do + a="$a -p $i" + done + /usr/bin/top $a + fi + ;; + *) + echo $"Usage: $PRIVOXY_PRG {start|stop|reload|restart|condrestart|status|top|kill}" + exit 1 +esac + +exit $RETVAL -- cgit v1.2.3