-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Ok, I'll just done your job. See attachements. I wrote squid.service, it takes approx. 30 seconds. PS. But note: you must install both files manually yourself. Read manuals anyway. 16.12.15 2:29, Sebastien.Boulianne@xxxxxx пишет: > Hi, > > Your answer didn’t help me. > Does it have anyone who create a service file for squid and want to share it. > I tried the squid.service from the yum package (v3.3.8) but it didn’t work. > > Thanks > > Sébastien > De : squid-users [mailto:squid-users-bounces@xxxxxxxxxxxxxxxxxxxxx] De la part de Yuri Voinov > Envoyé : 15 décembre 2015 10:35 > À : squid-users@xxxxxxxxxxxxxxxxxxxxx > Objet : Re: Installing Squid as a service on Oracle Linux 7.2 > > > Squid's source don't contain automatically installed autostart services for all possible platforms. You can do it yourself. > > 15.12.15 21:15, Sebastien.Boulianne@xxxxxx<mailto:Sebastien.Boulianne@xxxxxx> пишет: > > Hi, > > > > > I hope all is going perfectly for you. > > > > > Im trying to install Squid-3.5.12 from source. > > > I followed the doc to compile it properly. > > > > > When I ran squid -z, all is perfect. > > > > > [root@squid /]# squid -z > > > [root@squid /]# 2015/12/15 10:06:20 kid1| Set Current > Directory to /var/spool/squid > > > 2015/12/15 10:06:20 kid1| Creating missing swap directories > > > 2015/12/15 10:06:20 kid1| /var/spool/squid exists > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/00 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/01 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/02 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/03 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/04 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/05 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/06 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/07 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/08 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/09 > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/0A > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/0B > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/0C > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/0D > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/0E > > > 2015/12/15 10:06:20 kid1| Making directories in > /var/spool/squid/0F > > > > > But when I try to « service squid start », it fails... There > is no squid.service. > > > > > [root@squid /]# service squid start > > > Redirecting to /bin/systemctl start squid.service > > > Failed to start squid.service: Unit squid.service failed to > load: No such file or directory. > > > > > I searched for a doc how to create this file but I can't find > it. > > > > > Can you help me please ? > > > > > Sébastien Boulianne > > > Administrateur réseau & système / Network & System > Administrator. > > > Gestion des infrastructures / Infrastructure Management. > > > CCNA / CompTIA Server+ / Spécialiste en monitoring. > > > sebastien.boulianne@xxxxxx<mailto:sebastien.boulianne@xxxxxx><mailto:sebastien.boulianne@xxxxxx><mailto:sebastien.boulianne@xxxxxx> > > > > > [cid:image001.jpg@01D13720.14E92580] > > > > > > > 2323, du Versant Nord, suite 100 > > > Québec (Québec) G1N 4P4 > > > Téléphone : (418) 681 6974 poste 666 > > > Ligne sans frais : 1 888 681 6974 > > > Télécopieur : (418) 681 1444 > > > > > Information confidentielle : Le présent message, ainsi que > tout fichier qui y est joint, est envoyé à l'intention exclusive > de son ou de ses destinataires, il est de nature confidentielle et > peut constituer une information privilégiée. Nous avertissons > toute personne autre que le destinataire prévu que tout examen, > réacheminement, impression, copie, distribution ou autre > utilisation de ce message et de tout fichier qui y est joint est > strictement interdit. Si vous n'êtes pas le destinataire prévu, > veuillez en aviser immédiatement l'expéditeur par retour de > courriel et supprimer ce message et tout document joint de votre > système. Merci. > > > > > Confidentiality Warning : This message and any attachments > are intended only for the use of the intended recipient(s), are > confidential, and may be privileged. If you are not the intended > recipient, you are hereby notified that any review, > retransmission, conversion to hard copy, copying, circulation or > other use of this message and any attachments is strictly > prohibited. If you are not the intended recipient, please notify > the sender immediately by return e-mail, and delete this message > and any attachments from your system. Thank you. > > > > > « Gérer c'est prévoir (voir avant, avoir une vision de > l'avenir) » > > > [cid:image002.jpg@01D13720.14E92580] > > > > > > > > > > > _______________________________________________ > > > squid-users mailing list > > > squid-users@xxxxxxxxxxxxxxxxxxxxx<mailto:squid-users@xxxxxxxxxxxxxxxxxxxxx> > > > http://lists.squid-cache.org/listinfo/squid-users > > > > _______________________________________________ > squid-users mailing list > squid-users@xxxxxxxxxxxxxxxxxxxxx > http://lists.squid-cache.org/listinfo/squid-users -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWcH7uAAoJENNXIZxhPexGDbQH/RTjH2cN53mXTAzKsN/zCHD9 b5NfyQsqYHxctnWG1fpZScNubbUP2kwGMEZOd+7ZpImHpt73QktJ1irAgW4Zv5NW sgraQaCYPDzw1nWOHtDGnHaTI6UWa3BYNHQ6KklauBPcF3TRTAXf1n90CdTFpY0R 3OjJUgGc1nSQhDUN+tCK42JGL02+JkOTSiaOiF/DIBm/Yzs9JzW6J0F5HWsRn5GH mg++cFx6zBkRm/Av7mV493P1wQxdo0IywV/x1lpu9DSDz+VdsmQTFhD6BUO0eDvB NZCNJIcfLkFmCpEhR0UCf8OUepLrClgClzSIMcpnwJaf9OEb27+vJ6mKywDSCJE= =wvB9 -----END PGP SIGNATURE----- |
#!/bin/sh # chkconfig: 345 99 01 # description: Service for autostart Squid processes # processname: init.squid # # Control Method for Squid (/lib/svc/method/init.squid) # using SMF or init SysV (Linux). # Written by Yuri Voinov (C) 2007,2015 # # ident "@(#)squid.sh 2.5 15/12/01 YV" # ############# # Variables # ############# # Base Squid installation directory BASE_DIR="/usr/local/squid" # Squid files paths SQUID_PATH="$BASE_DIR""/sbin" SQUID_CONF_PATH="$BASE_DIR""/etc" # Squid files SQUID_BIN_FILE="squid" SQUID_CONF_FILE="squid.conf" # Squid effective user name SQUID_USER="squid" # Set file descriptors limit. See --with-maxfd/--with-filedescriptors option with squid configuration MAXFD=131072 # LD_LIBRARY_PATH additional setting. Change if another bdb version is installed. Bdb uses by squidGuard LD_ADD="/opt/csw/bdb48/lib/amd64:/opt/csw/lib/amd64" # Linux lock directory LOCK_DIR="/var/lock/subsys" # Script name for Linux up/down workaround SVC_SHORT_NAME="$SQUID_BIN_FILE" SCRIPT_NAME="init.$SVC_SHORT_NAME" # Log cache to syslog # Set to Y, if your need TO_SYSLOG="N" # # OS Commands location variables # CAT=`which cat` CUT=`which cut` ECHO=`which echo` GETENT=`which getent` GREP=`which grep` NEWTASK=`which newtask` PS=`which ps` TOUCH=`which touch` ULIMIT=`which ulimit` UNAME=`which uname` # OS release OS_VER=`$UNAME -r|$CUT -f2 -d"."` OS_NAME=`$UNAME -s|$CUT -f1 -d" "` ############### # Subroutines # ############### check_squid () { # Check Squid installed program=$1 if [ ! -f "$SQUID_PATH/$program" -a ! -x "$SQUID_PATH/$program" ]; then $ECHO "ERROR: Squid not found!" $ECHO "Exiting..." exit 1 fi } check_os () { if [ "$OS_NAME" = "SunOS" -a "$OS_VER" -lt "10" ]; then if [ "$OS_NAME" != "Linux" ]; then $ECHO "ERROR: Unsupported $OS_NAME version $OS_VER. Exiting..." exit 1 fi fi } checkuser () { # Check squid user username=$1 if [ ! -z "`$GETENT passwd $username`" ]; then $ECHO "1" else $ECHO "0" fi } checkconf () { # Check Squid config file config=$1 if [ -f "$SQUID_CONF_PATH"/"$config" ]; then $ECHO "1" else $ECHO "0" fi } checkrcapd () { # Check if rcapd running if [ ! -z "$PS -ef|$GREP -v grep|$GREP rcapd" ]; then $ECHO "1" else $ECHO "0" fi } startproc() { # Start Squid program=$1 # Set additional cache logging to syslog, if specified if [ "$TO_SYSLOG" = "Y" ]; then sl="s" else sl="" fi if [ "`checkconf $SQUID_CONF_FILE`" = "1" ]; then if [ "`checkuser $SQUID_USER`" = "1" ]; then LD_LIBRARY_PATH=$LD_ADD:$LD_LIBRARY_PATH export LD_LIBRARY_PATH $ULIMIT -Sn $MAXFD if [ ! -z "`$CAT /etc/project | $GREP "$SQUID_USER"`" -a "`checkrcapd`" -eq "1" ]; then $NEWTASK -p `$CAT /etc/project | $GREP "squid" | $CUT -f1 -d":"` $SQUID_PATH/$program -Y$sl else $SQUID_PATH/$program -Y$sl fi else $ECHO "ERROR: User $SQUID_USER not found." $ECHO "Exiting..." exit 3 fi else $ECHO "ERROR: Config file $SQUID_CONF_PATH/$SQUID_CONF_FILE not found." $ECHO "Exiting..." exit 2 fi if [ "$OS_NAME" = "Linux" ]; then # Linux up/down workaround $TOUCH "$LOCK_DIR"/"$SCRIPT_NAME" fi } stopproc() { # Stop Squid program=$1 if [ "`checkconf $SQUID_CONF_FILE`" = "1" ]; then if [ "`checkuser $SQUID_USER`" = "1" ]; then $SQUID_PATH/$program -k shutdown else $ECHO "ERROR: User $SQUID_USER not found." $ECHO "Exiting..." exit 3 fi else $ECHO "ERROR: Config file $SQUID_CONF_PATH/$SQUID_CONF_FILE not found." $ECHO "Exiting..." exit 2 fi if [ "$OS_NAME" = "Linux" ]; then # Linux up/down workaround $RM -f "$LOCK_DIR"/"$SCRIPT_NAME" fi } refreshproc() { # Refresh Squid program=$1 if [ "`checkconf $SQUID_CONF_FILE`" = "1" ]; then if [ "`checkuser $SQUID_USER`" = "1" ]; then $SQUID_PATH/$program -k reconfigure else $ECHO "ERROR: User $SQUID_USER not found." $ECHO "Exiting..." exit 2 fi else $ECHO "ERROR: Config file $SQUID_CONF_PATH/$SQUID_CONF_FILE not found." $ECHO "Exiting..." exit 2 fi } ############## # Main block # ############## # Check Squid installed check_squid $SQUID_BIN_FILE # Check OS version check_os case "$1" in "start") startproc $SQUID_BIN_FILE ;; "stop") stopproc $SQUID_BIN_FILE ;; "refresh") refreshproc $SQUID_BIN_FILE ;; "restart") stopproc $SQUID_BIN_FILE startproc $SQUID_BIN_FILE ;; *) $ECHO "Usage: $0 { start | stop | refresh | restart }" exit 1 esac exit 0 #
[Unit] Description=Squid Cache Service After=syslog.target [Service] ExecStart=/usr/lib/systemd/scripts/init.squid start ExecStop=/usr/lib/systemd/scripts/init.squid stop Restart=on-abort [Install] WantedBy=multi-user.target
_______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users