contribs: samsd.suse

File samsd.suse, 2.1 KB (added by PavelVinogradov, 3 years ago)

Скрипт запуска sams для SuSe? by Bum

Line 
1#! /bin/sh
2# Copyright (c) 2005 PermLUG http://www.permlug.org http://linux.perm.ru
3#
4# Author: Denis A. Baluev bum@permonline.ru
5#
6# This file is responsible  for  starting/stopping  services  Squid Account Management System (SAMS)
7#
8# based on squid scripts
9#                       Author: Frank Bodammer, Peter Poeml, Klaus Singvogel <feedback@suse.de>
10#                       Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
11#                       Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
12#                       Copyright (c) 2002 SuSE Linux AG
13#
14# idea Dmitry Chemerik chemerik@mail.ru
15#
16# init.d/samsd
17#
18### BEGIN INIT INFO
19# Provides:                     samsd
20# Required-Start:               $local_fs $remote_fs $network $named $time
21# X-UnitedLinux-Should-Start:   apache
22# Required-Stop:                $local_fs $remote_fs $network
23# X-UnitedLinux-Should-Stop:
24# Default-Start:                3 5
25# Default-Stop:                 0 1 2 6
26# Description:                  Start the Squid Account Management System
27### END INIT INFO
28
29SAMS_PATH=`cat /etc/sams.conf | grep SAMSPATH | tr "SAMSPATH=" "\0"`
30SAMS_BIN=$SAMS_PATH/bin/samsdaemon
31SAMS_PID=/var/run/samsdaemon.pid
32SAMS_CONF=/etc/sams.conf
33
34if [ ! -x $SQUID_BIN ] ; then
35        echo -n "Squid Account Management System not installed ! "
36        exit 5
37fi
38
39. /etc/rc.status
40RC_OPTIONS='-v'
41rc_reset
42
43ulimit -n 4096
44
45case "$1" in
46    start)
47        echo -n "Starting Squid Account Management System"
48        checkproc $SAMS_BIN
49        if [ $? -eq 0 ] ; then
50           echo -n "- Warning: SAMS already running ! "
51           rc_failed
52        else
53           [ -e $SAMS_PID ] && echo -n "- Warning: $SAMS_PID exists ! "
54                $SAMS_BIN -z -F > /dev/null 2>&1
55           sleep 2
56        fi
57        startproc -l /var/log/sams/sams.log $SAMS_BIN -sYD
58        rc_status $RC_OPTIONS
59        ;;
60    stop)
61        echo -n "Shutting down Squid Account Management System "
62           if checkproc $SAMS_BIN ; then
63              killproc -TERM $SAMS_BIN
64        else
65           echo -n "- Warning: sams not running ! "
66           rc_failed 7
67        fi
68        rc_status -v
69        ;;
70    restart)
71        $0 stop
72        $0 start
73        rc_status
74        ;;
75    status)
76        echo -n "Checking for Squid Account Management System"
77        checkproc $SAMS_BIN
78        rc_status -v
79        ;;
80    *)
81        echo "Usage: $0 {start|stop|restart|status}"
82        exit 1
83        ;;
84esac
85rc_exit
86