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@
25 # ---------------------------------------------------------------------------
26 # Make sure we're running as the correct user
27 # ---------------------------------------------------------------------------
28 [ $(whoami) != 'opensrf' ] && echo 'Must run as user "opensrf"' && exit;
34 usage: $0 [OPTION]... -c <c_config> -a <action>
39 Optional parameters:";
40 -c full path to C configuration file (opensrf_core.xml)
41 -d store PID files in this directory
42 -l accept 'localhost' as the fully-qualified domain name
51 $0 -l -c opensrf_core.xml -a restart_all
56 # ---------------------------------------------------------------------------
57 # Load the command line options and set the global vars
58 # ---------------------------------------------------------------------------
59 while getopts "a:d:c:s:k:lh" flag; do
61 "a") OPT_ACTION="$OPTARG";;
62 "c") OPT_CONFIG="$OPTARG";;
63 "d") OPT_PID_DIR="$OPTARG";;
64 "l") export OSRF_HOSTNAME="localhost";;
69 OSRF_CONFIG="@bindir@/osrf_config"
70 [ ! -f "$OSRF_CONFIG" ] && OSRF_CONFIG=`which osrf_config`
72 [ -z "$OPT_CONFIG" ] && OPT_CONFIG=`$OSRF_CONFIG --sysconfdir`/opensrf_core.xml;
73 if [ ! -r "$OPT_CONFIG" ]; then
74 echo "Please specify the location of the opensrf_core.xml file using the -c flag";
77 [ -z "$OPT_PID_DIR" ] && OPT_PID_DIR=`$OSRF_CONFIG --localstatedir`/run/opensrf;
78 [ -z "$OPT_ACTION" ] && usage;
82 opensrf-perl.pl --pid-dir $OPT_PID_DIR \
83 --config $OPT_CONFIG --start-all --settings-startup-pause 3
87 opensrf-perl.pl --pid-dir $OPT_PID_DIR --config $OPT_CONFIG --stop-all
90 # ---------------------------------------------------------------------------
91 # Do the requested action
92 # ---------------------------------------------------------------------------
93 echo "$0 is deprecated. Use osrf_control instead"
96 "stop_all") stop_all;;
97 "start_all") start_all;;
98 "restart_all") stop_all; start_all;;