3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # Strictness to avoid folly
18 exec_prefix=@exec_prefix@
27 # ---------------------------------------------------------------------------
28 # Make sure we're running as the correct user
29 # ---------------------------------------------------------------------------
30 [ $(whoami) != 'opensrf' ] && echo 'Must run as user "opensrf"' && exit;
36 usage: $0 [OPTION]... -c <c_config> -a <action>
41 Optional parameters:";
42 -c full path to C configuration file (opensrf_core.xml)
43 -d store PID files in this directory
44 -l accept 'localhost' as the fully-qualified domain name
50 smart_clear - Clear all PID files that don't refer to a process
51 clear_pid - Clear all PID files
55 $0 -l -c opensrf_core.xml -a restart_all
60 # ---------------------------------------------------------------------------
61 # Load the command line options and set the global vars
62 # ---------------------------------------------------------------------------
63 while getopts "a:d:c:s:k:lh" flag; do
65 "a") OPT_ACTION="$OPTARG";;
66 "c") OPT_CONFIG="$OPTARG";;
67 "d") OPT_PID_DIR="$OPTARG";;
68 "s") OPT_SERVICE="$OPTARG";;
69 "k") OPT_SIGNAL="$OPTARG";;
70 "l") export OSRF_HOSTNAME="localhost";;
75 OSRF_CONFIG="@bindir@/osrf_config"
76 [ ! -f "$OSRF_CONFIG" ] && OSRF_CONFIG=`which osrf_config`
78 [ -z "$OPT_CONFIG" ] && OPT_CONFIG=`$OSRF_CONFIG --sysconfdir`/opensrf_core.xml;
79 if [ ! -r "$OPT_CONFIG" ]; then
80 echo "Please specify the location of the opensrf_core.xml file using the -c flag";
83 [ -z "$OPT_PID_DIR" ] && OPT_PID_DIR=`$OSRF_CONFIG --localstatedir`/run/opensrf;
84 [ -z "$OPT_ACTION" ] && usage;
88 opensrf-perl.pl --verbose --pid-dir $OPT_PID_DIR \
89 --config $OPT_CONFIG --start-all --settings-startup-pause 3
93 opensrf-perl.pl --verbose --pid-dir $OPT_PID_DIR --config $OPT_CONFIG --stop-all
96 # ---------------------------------------------------------------------------
97 # Do the requested action
98 # ---------------------------------------------------------------------------
99 echo "$0 is deprecated. Use opensrf-perl.pl instead"
101 "stop_all") stop_all;;
102 "start_all") start_all;;
103 "restart_all") stop_all; start_all;;