2 # ********************************************************************
4 # File : $Source: /cvsroot/ijbswa/current/junkbuster.init,v $
6 # Purpose : This shell script takes care of starting and stopping
8 # This works only correctly if the user `nobody' is allowed
9 # to be in the directory where this file is called
10 # (for example: /root is NOT ok)
12 # Copyright : Written by and Copyright (C) 2001 the SourceForge
13 # IJBSWA team. http://ijbswa.sourceforge.net
15 # Based on the Internet Junkbuster originally written
16 # by and Copyright (C) 1997 Anonymous Coders and
17 # Junkbusters Corporation. http://www.junkbusters.com
19 # This program is free software; you can redistribute it
20 # and/or modify it under the terms of the GNU General
21 # Public License as published by the Free Software
22 # Foundation; either version 2 of the License, or (at
23 # your option) any later version.
25 # This program is distributed in the hope that it will
26 # be useful, but WITHOUT ANY WARRANTY; without even the
27 # implied warranty of MERCHANTABILITY or FITNESS FOR A
28 # PARTICULAR PURPOSE. See the GNU General Public
29 # License for more details.
31 # The GNU General Public License should be included with
32 # this file. If not, you can view it at
33 # http://www.gnu.org/copyleft/gpl.html
34 # or write to the Free Software Foundation, Inc., 59
35 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 # $Log: junkbuster.init,v $
39 # Revision 1.2 2001/05/24 07:52:24 swa
40 # added header. removed ^M.
43 # ********************************************************************/
45 # These lines are needed so Redhat's config tools will "see" this script:
47 # description: Blocks annoying ads from the internet, along with cookies \
48 # and a few other privacy features.
49 # processname: junkbuster
50 # config: /etc/junkbuster/config
52 # ---------------------------------------------------------------------------
55 # FIXME: I need to be updated using the latest skeleton script from SuSE
57 # ---------------------------------------------------------------------------
58 if [ -f /etc/rc.config ]; then
60 # Author: Daniel Bischof <daniel@suse.de>, 1999
61 # Adjustment: Axel Braun <doc.b@gmx.de>, 17.08.2000
64 #link=${base#*[SK][0-9][0-9]}
65 #test $link = $base && START_IJB=yes
66 #test "$START_IJB" = "yes" || exit 0
70 echo -n "Starting The Internet Junkbuster"
71 su - nobody -c 'nohup /usr/sbin/junkbuster /etc/junkbuster/config < /dev/null > /dev/null &'
76 echo -n "Shutting down The Internet Junkbuster"
77 killproc -TERM /usr/sbin/junkbuster || return=$rc_failed
81 echo -n "Reload The Internet Junkbuster"
82 killproc -HUP /usr/sbin/junkbuster || return=$rc_failed
86 checkproc /usr/sbin/junkbuster && echo OK || echo No process
89 echo "Usage: $0 {start|restart|status|stop}"
92 test "$return" = "$rc_done" || exit 1
96 # ---------------------------------------------------------------------------
100 # ---------------------------------------------------------------------------
102 # Source function library.
103 if [ -f /etc/rc.d/init.d/functions ]; then
104 . /etc/rc.d/init.d/functions
107 if [ -f /etc/sysconfig/network ]; then
108 . /etc/sysconfig/network
111 # Check that networking is up.
112 [ ${NETWORKING} = "no" ] && exit 0
114 [ -f /etc/junkbuster/config ] || exit 0
116 [ -f /usr/sbin/junkbuster ] || exit 0
120 # See how we were called.
124 # abort if already started
125 pid=`pidofproc junkbuster`
126 [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && \
127 echo -n "Already started: " && status junkbuster && \
131 echo -n "Starting junkbuster:" && RETVAL=1
133 su - nobody -s /bin/sh -c '/usr/sbin/junkbuster /etc/junkbuster/config' &
135 pid=`pidofproc junkbuster`
136 [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && RETVAL=0 && echo_success && touch /var/lock/subsys/junkbuster
137 [ $RETVAL -eq 1 ] && echo_failure
143 echo -n "Shutting down junkbuster:"
146 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/junkbuster
160 echo "Usage: junkbuster {start|stop|status|restart|reload}"