source: WAeUP_SysConf/logging/trunk/usr/local/sbin/zopectl-srp @ 2879

Last change on this file since 2879 was 2826, checked in by uli, 17 years ago

Added logging scripts and configs.

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/sh
2
3##
4## zopectl-srp
5##
6## starts, stops or restarts all srp-clients.
7##
8## Syntax: zopectl-srp [start|stop|restart]
9##
10## (c) 2006 Uli Fouquet and waeup.org
11
12## All clients to handle...
13CLIENTDIRS="srp srp-ssl01"
14## Where do the clients reside?
15CLIENTHOMES="/zope/instances/"
16
17CURR_DIR=`pwd`
18
19## We expect at least one argument...
20if [ -z $1 ]; then
21    echo "Usage: $0 [start|stop|restart|logreopen]"
22    echo "Starts, stops or restarts all srp clients"
23    exit
24fi
25
26## We support help options...
27HELPLIST="help -help --help -h"
28for TOKEN in $HELPLIST; do
29    if [ $1 = $TOKEN ]; then
30        echo "Usage: $0 [start|stop|restart|logreopen]"
31        echo "Starts, stops or restarts all srp clients"
32        exit
33    fi
34done
35
36## We only allow root to run thos script.
37if [ $EUID -ne 0 ]; then
38    echo "You must be root to execute this script."
39    exit
40fi
41
42
43if [ -f /etc/default/zopectl-srp ]; then
44    . /etc/default/zopectl-srp
45fi
46
47echo "Handling instances in $CLIENTHOMES"
48
49## Do $1 to every single client...
50for DIR in $CLIENTDIRS; do
51        echo "Handling instance: $DIR";
52        echo "  waiting 10 secs..."
53        sleep 10
54
55        ## Does the clienthome exist?
56        if [ ! -d $CLIENTHOMES$DIR ]; then
57            echo "Can't find $CLIENTHOMES$DIR."
58            echo "Omitting this client."
59        else
60            ZOPECTLSCRIPT=$CLIENTHOMES$DIR/bin/zopectl
61
62            ## Does the zopectl-script exist?
63            if [ ! -x $ZOPECTLSCRIPT ]; then
64                echo "Can't find executable $ZOPECTLSCRIPT"
65                echo "Omitting this client"
66            else
67                ## Do it...
68                echo "Doing $ZOPECTLSCRIPT $1"
69                $ZOPECTLSCRIPT $1
70            fi
71        fi
72done
73
74cd $CURR_DIR
Note: See TracBrowser for help on using the repository browser.