• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

Baffling Linuxconf Behavior

I recently compiled and installed squid in /usr/local/squid on a box at my school and modified the squid init.d script that comes in the Redhat squid RPM distribution to point to the new file locations.  Startups, shutdowns and runtime level changes seems to work fine, but whenever I run Linuxconf, upon exiting it wants to stop the squid service.

I have checked /etc/rc.d/rc3.d and everything seems to be correct.  There is a S86squid soft link, but no K86squid.  I think I modified everything correctly in the /etc/rc.d/init.d/squid service control script, but I could be mistaken.

Does anyone have any insight into why Linuxconf would want to stop the squid service when it is not part of the /etc/rc.d/init.d runtime level definitions?

[root@heretic rc3.d]# ls (/etc/rc.d/rc3.d)
K10pulse    K30sendmail  K89portmap  S20random  S50inet      S90xfs
K20rstatd   K55routed    K91gpm      S30syslog  S75keytable  S99linuxconf
K20rusersd  K60lpd       S05kudzu    S40atd     S85httpd     S99local
K20rwhod    K75netfs     S10network  S40crond   S86squid

/etc/rc.d/init.d/squid (modified from Redhat 6.1 squid RPM)
#!/bin/bash
# squid  This shell script takes care of starting and stopping
#  Squid Internet Object Cache
#
# chkconfig: - 90 25
# description: Squid - Internet Object Cache. Internet object caching is \
#  a way to store requested Internet objects (i.e., data available \
#  via the HTTP, FTP, and gopher protocols) on a system closer to the \
# requesting site than to the source. Web browsers can then use the \
# local Squid cache as a proxy HTTP server, reducing access time as \
# well as bandwidth consumption.
# pidfile: /var/run/squid.pid
# config: /usr/local/squid/bin/squid/squid.conf

PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# check if the squid conf file is present
[ -f /usr/local/squid/etc/squid.conf ] || exit 0

# determine the name of the squid binary
SQUID=squid
[ -z "$SQUID" ] && exit 0

# determine which one is the cache_swap directory
CACHE_SWAP=`sed -e 's/#.*//g' /usr/local/squid/etc/squid.conf |
 grep cache_dir | sed -e 's/cache_dir//' | \
 cut -d ' ' -f 2`
[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/spool/squid

# default squid options
# -D disables initial dns checks. If you most likely will not to have an
#    internet connection when you start squid, uncomment this
SQUID_OPTS="-D"

RETVAL=0
case "$1" in
start)
    echo -n "Starting $SQUID: "
    for adir in $CACHE_SWAP; do
        if [ ! -d $adir/00 ]; then
      echo -n "init_cache_dir $adir... "
      $SQUID -z -F 2>/dev/null
 fi
    done
    /usr/local/squid/bin/squid $SQUID_OPTS &
    RETVAL=$?
    echo $SQUID
    echo ""
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SQUID
    ;;

stop)
    echo -n "Stopping $SQUID: "
    /usr/local/squid/bin/squid -k shutdown &
    RETVAL=$?
    if [ $RETVAL -eq 0 ] ; then
     rm -f /var/lock/subsys/$SQUID
  while : ; do
  [ -f /var/run/squid.pid ] || break
  sleep 2 && echo -n "."
     done
     echo "done"
    else
     echo
    fi
    ;;

reload)
    /usr/local/squid/bin/squid $SQUID_OPTS -k reconfigure
    exit $?
    ;;

restart)
    $0 stop
    $0 start
    ;;

status)
    status $SQUID
    /usr/local/squid/bin/squid -k check
    exit $?
    ;;

probe)
    exit 0;
    ;;

*)
    echo "Usage: $0 {start|stop|status|reload|restart}"
    exit 1
esac

exit $RETVAL


0
laven
Asked:
laven
  • 4
  • 3
  • 2
  • +3
1 Solution
 
lavenAuthor Commented:
Edited text of question.
0
 
Manfred BertlManagerCommented:
try the program 'webmin' at www.webmin.com. whith this program, you can set the actions and programs in the runlevels in every way you want.
0
 
mzehnerCommented:
First of all when I setup squid to run using linuxconf, it puts the link file in as "/etc/rc.d/rc3.d/S90squid" linking of course to "../init.d/squid" which is your modified file.  You have called your startup file "S86squid" which conflicts with what linuxconf wants to call it (at least in my RH6.1 distribution).  Linuxconf checks your files in your rc3.d directory and other rcx.d directories for all runlevels in order to evaluate what is running.
The easiest way to solve your problem is to move your "/etc/rc.d/rc3.d/S86.squid" file(which by all rights works but conflicts with linuxconf and its naming convention) out of the /etc/rc.d/rc3.d subdirectory.  Then activate squid using the linuxconf program and it will create the link file for you, but it will still point to your modified "/etc/rc.d/init.d/squid" file.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
lavenAuthor Commented:
Sorry, I had already tried this.  Linuxconf seems to not care about the service number on the squid symlink in /etc/rc.d/rc3.d

I'm thinking some other possibilities could be in my /etc/rc.d/init.d/squid script.  Something like permission errors or script errors in not being able to correctly write and touch the .pid file or lock file in the /var filesystem.  Does linuxconf touch these, and could this lead to it wanting to stop the squid service?
0
 
mzehnerCommented:
Sorry, I didn't read your message close enough the first time.  You will not have a kill script for squid in rc3.d, but in rc0.d and rc6.d.  I believe you are correct about your script file having problems though.  I think you may be running some combination of the original squid program program and your program.  Try changing the line "SQUID=squid" to "[ -f /usr/local/squid/bin/squid ] && SQUID=/usr/local/squid/bin/squid"  or change every occurence of where "$SQUID" is used to "/usr/local/squid/bin/squid"  The line below:
$SQUID -z -F 2>/dev/null
does invoke the squid program via the path in /usr/sbin!
I'm not an expert in squid and I don't see how it may affect linuxconf unless you are really running 2 versions of squid simultaneously, but I am pretty sure your script file is not correct.
I'm still trying to figure out what the "-z -F 2>/dev/null" does.  I think "-z -F" are squid options and "2>/dev/null" are directing stderr to /dev/null.
0
 
lavenAuthor Commented:
I know for sure that I am not running two simultaneous squid versions.  I am running the standard installation of squid when compiled from the source and "make install"ed.

After I have confirmed that squid is working properly, I thought about how I could have the service start automatically.  I examined how Redhat handled its service starts and stops and looked at the Redhat squid RPM (pre-compiled binary package).  Within that RPM it had a /etc/rc.d/init.d/squid script, so I figured it would be easy for me to modify this script for my own usage.

I admit the script edidting was a rush job, but the end result seemed to work fine in boots, shutdowns and runtime level changes.  This strange Linuxconf behavior is the only symptom.

The hard drive in that box just fried itself, so I will have to continue work on this tomorrow after I get a replacement from the local store.  If anyone else knows anything about this linuxconf behavior please feel free to post.

(Increasing question points)
0
 
Barn_OwlCommented:
I don't use linuxconf much at all. But have you made sure that you do not have not told linuxconf to kill squid and not changed that behaviour.
0
 
ahoffmannCommented:
>  [ -f /var/run/squid.pid ] || break
you use this in your "stop" case, but never define/write this file
That's not the reason of your problem, but probably RedHat has a script which checks for such pid-files and then stops corresponding processes anyhow. Check the rc.local, rc.boot etc. scripts and/or linuxconf script (or whatever it is called on RedHat)
0
 
lavenAuthor Commented:
I found the problem late yesterday.  Apparently linuxconf had a problem with my script because my squid binary wasn't in my default path.  I changed all references to $SQUID to the full path of the binary, and somehow linuxconf no longer behaves strangely.

Now how do I close this thread?...
0
 
Manfred BertlManagerCommented:
you give the points to the person who's comment fits best.
0
 
mzehnerCommented:
That's what I was trying to tell you.  If you still had a copy of squid in /usr/bin it would try to refer to that one.  If it was not there, then of course it could not be used by the system as intended.  That's why I said to make everything referring to squid use "/usr/local/squid/bin/squid".
0
 
kodiakbearCommented:
fixed this question which was locked in a -1 error

kb
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now