2 # ********************************************************************
4 # File : $Source: /cvsroot/ijbswa/current/loaders.c,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.
40 # ********************************************************************/
42 # These lines are needed so Redhat's config tools will "see" this script:
44 # description: Blocks annoying ads from the internet, along with cookies \
45 # and a few other privacy features.
46 # processname: junkbuster
47 # config: /etc/junkbuster/config
49 # ---------------------------------------------------------------------------
53 # ---------------------------------------------------------------------------
54 if [ -f /etc/rc.config ]; then
56 # Author: Daniel Bischof <daniel@suse.de>, 1999
57 # Adjustment: Axel Braun <doc.b@gmx.de>, 17.08.2000
60 #link=${base#*[SK][0-9][0-9]}
61 #test $link = $base && START_IJB=yes
62 #test "$START_IJB" = "yes" || exit 0
66 echo -n "Starting The Internet Junkbuster"
67 su - nobody -c 'nohup /usr/sbin/junkbuster /etc/junkbuster/config < /dev/null > /dev/null &'
72 echo -n "Shutting down The Internet Junkbuster"
73 killproc -TERM /usr/sbin/junkbuster || return=$rc_failed
77 echo -n "Reload The Internet Junkbuster"
78 killproc -HUP /usr/sbin/junkbuster || return=$rc_failed
82 checkproc /usr/sbin/junkbuster && echo OK || echo No process
85 echo "Usage: $0 {start|restart|status|stop}"
88 test "$return" = "$rc_done" || exit 1
92 # ---------------------------------------------------------------------------
96 # ---------------------------------------------------------------------------
98 # Source function library.
99 if [ -f /etc/rc.d/init.d/functions ]; then
100 . /etc/rc.d/init.d/functions
103 if [ -f /etc/sysconfig/network ]; then
104 . /etc/sysconfig/network
107 # Check that networking is up.
108 [ ${NETWORKING} = "no" ] && exit 0
110 [ -f /etc/junkbuster/config ] || exit 0
112 [ -f /usr/sbin/junkbuster ] || exit 0
116 # See how we were called.
120 # abort if already started
121 pid=`pidofproc junkbuster`
122 [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && \
123 echo -n "Already started: " && status junkbuster && \
127 echo -n "Starting junkbuster:" && RETVAL=1
129 su - nobody -s /bin/sh -c '/usr/sbin/junkbuster /etc/junkbuster/config' &
131 pid=`pidofproc junkbuster`
132 [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && RETVAL=0 && echo_success && touch /var/lock/subsys/junkbuster
133 [ $RETVAL -eq 1 ] && echo_failure
139 echo -n "Shutting down junkbuster:"
142 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/junkbuster
156 echo "Usage: junkbuster {start|stop|status|restart|reload}"