• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] Squid, selbst kompiliert, beim booten starten?

crazyrolf

Advanced Hacker
Ich habe den squid selbst compiliert, läuft auch super, mit anmeldung am proxy mittels Passwort und Benutzername.
Da ich squid aber selbst compiliert habe, taucht er nicht im Runlevel auf.
Wie bringe ich den Proxy jetzt dazu, bei booten automatisch zu starten?

SUSE 9.1

Danke für die Hlfe
Crazy
 

oc2pus

Ultimate Guru
#! /bin/sh
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
# Copyright (c) 2002 SuSE Linux AG
#
# Author: Frank Bodammer, Peter Poeml, Klaus Singvogel <feedback@suse.de>
#
# init.d/squid
#
### BEGIN INIT INFO
# Provides: squid
# Required-Start: $local_fs $remote_fs $network $named $time
# X-UnitedLinux-Should-Start: apache
# Required-Stop: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Squid web cache
# Description: Start the Squid web cache, providing
# HTTP, FTP and other proxy services
### END INIT INFO


SQUID_BIN=/usr/sbin/squid
SQUID_PID=/var/run/squid.pid
SQUID_CONF=/etc/squid/squid.conf

if [ ! -x $SQUID_BIN ] ; then
echo -n "WWW-proxy squid not installed ! "
exit 5
fi

. /etc/rc.status
RC_OPTIONS='-v'
rc_reset

ulimit -n 4096
# determine which one is the cache_swap directory
CACHE_SWAP=`perl -n -e \
'/^cache_dir\s+\S+\s+(.*)\s+\d+\s+\d+\s+\d+/ && print "\$1 "' \
/etc/squid/squid.conf`
[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/cache/squid

case "$1" in
start)
echo -n "Starting WWW-proxy squid "
checkproc $SQUID_BIN
if [ $? -eq 0 ] ; then
echo -n "- Warning: squid already running ! "
rc_failed
else
[ -e $SQUID_PID ] && echo -n "- Warning: $SQUID_PID exists ! "
for adir in $CACHE_SWAP ; do
if [ ! -d $adir/00 ]; then # create missing cache directories
umask 027 # prevent users reading any cache data
echo -n " ($adir)"
$SQUID_BIN -z -F > /dev/null 2>&1
fi
if [ ! -d $adir/00 ]; then
echo " - Could not create cache_dir ! "
rc_failed
rc_status -v
rc_exit
fi
done
sleep 2
fi
startproc -l /var/log/squid/rcsquid.log $SQUID_BIN -sYD
rc_status $RC_OPTIONS
;;
stop)
echo -n "Shutting down WWW-proxy squid "
if checkproc $SQUID_BIN ; then
$SQUID_BIN -k shutdown
sleep 2
if [ -e $SQUID_PID ] ; then
echo -n "- wait a minute "
i=60
while [ -e $SQUID_PID ] && [ $i -gt 0 ] ; do
sleep 2
i=$[$i-1]
echo -n "."
[ $i -eq 41 ] && echo
done
fi
if checkproc $SQUID_BIN ; then
killproc -TERM $SQUID_BIN
echo -n " Warning: squid killed !"
fi
else
echo -n "- Warning: squid not running ! "
rc_failed 7
fi
rc_status -v
;;
try-restart)
$0 stop && $0 start
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
$0 reload
rc_status
;;
reload)
echo -n "Reloading WWW-proxy squid "
if checkproc $SQUID_BIN ; then
$SQUID_BIN -k rotate
sleep 2
$SQUID_BIN -k reconfigure
rc_status
else
echo -n "- Warning: squid not running ! "
rc_failed 7
fi
rc_status -v
;;
status)
echo -n "Checking for WWW-proxy squid "
checkproc $SQUID_BIN
rc_status -v
;;
probe)
test $SQUID_CONF -nt $SQUID_PID && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit

nach /etc/init.d/squid kopieren

cd /etc/init.d
insserv squid

und noch einen Link für Startscript erstelln
ln -s /etc/init.d/squid /usr/sbin/rcsquid
 
OP
crazyrolf

crazyrolf

Advanced Hacker
HAllo danke für die schnelle Antwort.

Leider geht das so nicht.
Musste ein paar zeilen ändern da mein squid wo anders liegt.
Könnte daran liegen?

Fehler beim Start:
/etc/init.d/squid start gab 7 (Programm wird nicht ausgeführt) zurück:
Starting WWW-proxy squid ..failed

Die geänderte Datei:

#! /bin/sh
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
# Copyright (c) 2002 SuSE Linux AG
#
# Author: Frank Bodammer, Peter Poeml, Klaus Singvogel <feedback@suse.de>
#
# init.d/squid
#
### BEGIN INIT INFO
# Provides: squid
# Required-Start: $local_fs $remote_fs $network $named $time
# X-UnitedLinux-Should-Start: apache
# Required-Stop: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Squid web cache
# Description: Start the Squid web cache, providing
# HTTP, FTP and other proxy services
### END INIT INFO


SQUID_BIN=/usr/local/squid/sbin/
SQUID_PID=/usr/local/squid/var/logs/squid.pid
SQUID_CONF=/usr/local/squid/etc/squid.conf

if [ ! -x $SQUID_BIN ] ; then
echo -n "WWW-proxy squid not installed ! "
exit 5
fi

. /etc/rc.status
RC_OPTIONS='-v'
rc_reset

ulimit -n 4096

# determine which one is the cache_swap directory
CACHE_SWAP=`perl -n -e \
'/^cache_dir\s+\S+\s+(.*)\s+\d+\s+\d+\s+\d+/ && print "\$1 "' \
/usr/local/squid/etc/squid.conf`
[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/usr/local/squid/var/cache

case "$1" in
start)
echo -n "Starting WWW-proxy squid "
checkproc $SQUID_BIN
if [ $? -eq 0 ] ; then
echo -n "- Warning: squid already running ! "
rc_failed
else
[ -e $SQUID_PID ] && echo -n "- Warning: $SQUID_PID exists ! "
for adir in $CACHE_SWAP ; do
if [ ! -d $adir/00 ]; then # create missing cache directories
umask 027 # prevent users reading any cache data
echo -n " ($adir)"
$SQUID_BIN -z -F > /dev/null 2>&1
fi
if [ ! -d $adir/00 ]; then
echo " - Could not create cache_dir ! "
rc_failed
rc_status -v
rc_exit
fi
done
sleep 2
fi
startproc -l /usr/local/squid/var/logs/rcsquid.log $SQUID_BIN -sYD
rc_status $RC_OPTIONS
;;
stop)
echo -n "Shutting down WWW-proxy squid "
if checkproc $SQUID_BIN ; then
$SQUID_BIN -k shutdown
sleep 2
if [ -e $SQUID_PID ] ; then
echo -n "- wait a minute "
i=60
while [ -e $SQUID_PID ] && [ $i -gt 0 ] ; do
sleep 2
i=$[$i-1]
echo -n "."
[ $i -eq 41 ] && echo
done
fi
if checkproc $SQUID_BIN ; then
killproc -TERM $SQUID_BIN
echo -n " Warning: squid killed !"
fi
else
echo -n "- Warning: squid not running ! "
rc_failed 7
fi
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
$0 reload
rc_status
;;
reload)
echo -n "Reloading WWW-proxy squid "
if checkproc $SQUID_BIN ; then
$SQUID_BIN -k rotate
sleep 2
$SQUID_BIN -k reconfigure
rc_status
else
echo -n "- Warning: squid not running ! "
rc_failed 7
fi
rc_status -v
;;
status)
echo -n "Checking for WWW-proxy squid "
checkproc $SQUID_BIN
rc_status -v
;;
probe)
test $SQUID_CONF -nt $SQUID_PID && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit
 

oc2pus

Ultimate Guru
yepp, deine Umgebung musst du schon selber einarbeiten ;))

das Startscript ist von meinem squid running on SuSE 8.2
sollte dir auch nur die Idee liefern ;)

im Verzeichnis /etc/init.d gibt es auch eine leere Sample Datei (skeletton?)

aber das Prinzip ist für alle SuSE's gleich.
 
OP
crazyrolf

crazyrolf

Advanced Hacker
fehler gefunden!

Danke super das teil läuft!

FALSCH: SQUID_BIN=/usr/local/squid/sbin/
Richtig: SQUID_BIN=/usr/local/squid/sbin/squid

Danke!

Crazy
 

li

Newbie
Also am einfachsten geht das mit dem Befehl

insserv squid

so wird er automatisch bein staten aufgerufen
 

moenk

Administrator
Teammitglied
Das mit insserv geht nur, wenn das Skript auch da ist. Der gewählte Weg dürfte passen: Skript von SuSE anpassen, so dass die Pfade für das eigene Compilat passen. Alternativ so compilieren wie SuSE, das kann man auch machen.
 
Oben