wok diff squid/stuff/etc/init.d/squid @ rev 20167
Up smtube, smplayer (18.1.0)
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Thu Jan 11 13:05:26 2018 +0100 (2018-01-11) |
parents | 1b6281d68d9f |
children |
line diff
1.1 --- a/squid/stuff/etc/init.d/squid Fri Sep 10 16:25:17 2010 +0200 1.2 +++ b/squid/stuff/etc/init.d/squid Thu Jan 11 13:05:26 2018 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 #!/bin/sh 1.5 -# /etc/init.d/squid : Start, stop and restart Squid proxy server on SliTaz, at 1.6 +# /etc/init.d/squid : Start, stop and restart Squid proxy server on SliTaz, at 1.7 # boot time or with the command line. 1.8 # 1.9 # To start Squid proxy server at boot time, just put squid in the $RUN_DAEMONS 1.10 @@ -9,38 +9,38 @@ 1.11 . /etc/daemons.conf 1.12 1.13 NAME=Squid 1.14 -DESC="Squid proxy server" 1.15 +DESC="$(_ 'Squid proxy server')" 1.16 DAEMON=/usr/sbin/squid 1.17 OPTIONS=$SQUID_OPTIONS 1.18 PIDFILE=/var/run/squid.pid 1.19 -http_port=$(grep ^http_port /etc/squid/squid.conf | awk '{ print $2 }') 1.20 +http_port=$(grep ^http_port /etc/squid/squid.conf | awk '{print $2}') 1.21 [ -n "$http_port" ] || http_port=3128 1.22 [ -n "$OPTIONS" ] || OPTIONS="-a $http_port" 1.23 1.24 case "$1" in 1.25 start) 1.26 if active_pidfile $PIDFILE squid ; then 1.27 - echo "$NAME already running." 1.28 + _ '%s is already running.' $NAME 1.29 exit 1 1.30 fi 1.31 - cache_dir=$(grep ^cache_dir /etc/squid/squid.conf | awk '{ print $3 }') 1.32 + cache_dir=$(grep ^cache_dir /etc/squid/squid.conf | awk '{print $3}') 1.33 [ -n "$cache_dir" ] || cache_dir=/var/cache 1.34 if [ -d "$cache_dir" -a ! -d "$cache_dir/00" ]; then 1.35 - echo -n "Creating squid spool directory structure" 1.36 - $DAEMON -z > /dev/null 2>&1 1.37 + action 'Creating squid spool directory structure' 1.38 + $DAEMON -z >/dev/null 2>&1 1.39 status 1.40 fi 1.41 - echo -n "Starting $DESC: $NAME... " 1.42 + action 'Starting %s: %s...' "$DESC" $NAME 1.43 $DAEMON $OPTIONS 1.44 status 1.45 sleep 2 1.46 ;; 1.47 stop) 1.48 if ! active_pidfile $PIDFILE squid ; then 1.49 - echo "$NAME is not running." 1.50 + _ '%s is not running.' $NAME 1.51 exit 1 1.52 fi 1.53 - echo -n "Stopping $DESC: $NAME... " 1.54 + action 'Stopping %s: %s...' "$DESC" $NAME 1.55 $DAEMON -k kill 1.56 status 1.57 rm -f $PIDFILE 1.58 @@ -48,27 +48,26 @@ 1.59 ;; 1.60 reload) 1.61 if ! active_pidfile $PIDFILE squid ; then 1.62 - echo "$NAME is not running." 1.63 + _ '%s is not running.' $NAME 1.64 exit 1 1.65 fi 1.66 - echo -n "Reloading $DESC configuration... " 1.67 + action 'Reloading %s configuration...' $NAME 1.68 $DAEMON -k reconfigure 1.69 status 1.70 ;; 1.71 restart) 1.72 if ! active_pidfile $PIDFILE squid ; then 1.73 - echo "$NAME is not running." 1.74 + _ '%s is not running.' $NAME 1.75 exit 1 1.76 fi 1.77 - echo -n "Restarting $DESC: $NAME... " 1.78 - $DAEMON -k kill && $DAEMON $OPTIONS 1.79 + action 'Restarting %s: %s...' "$DESC" $NAME 1.80 + $DAEMON -k kill && $DAEMON $OPTIONS 1.81 status 1.82 sleep 2 1.83 ;; 1.84 *) 1.85 - echo "" 1.86 - echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|reload|restart]" 1.87 - echo "" 1.88 + emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]" 1.89 + newline 1.90 exit 1 1.91 ;; 1.92 esac