]> git.evergreen-ils.org Git - working/Evergreen.git/blob - OpenSRF/bin/opensrf_ctl
changed router binary to opensrf_router to prevent opensrf_all from destroying
[working/Evergreen.git] / OpenSRF / bin / opensrf_ctl
1 #!/bin/bash
2
3
4 #  Simple rc script for controlling the system
5 #  Only works on linux because of 'ps' syntax
6 #
7
8 function usage {
9         echo "usage: $0 [start|stop|restart|status] <boostrap_config (on start and restart)>";
10         exit;
11 }
12
13 function startSystem {
14
15         case $1 in 
16         
17                 "start")
18                         [ -z "$2" ] && usage;
19                         perl -MOpenSRF::System="$2" -e 'OpenSRF::System->bootstrap()' & 
20                         sleep 5;
21                         $0 status;
22                         echo;
23                         ;;
24         
25                 "startprofile")
26                         [ -z "$2" ] && usage;
27                         OPENSRF_PROFILE=1 perl -MOpenSRF::System="$2" -e 'OpenSRF::System->bootstrap()' & 
28                         sleep 5;
29                         $0 status;
30                         echo;
31                         ;;
32         
33                 "stop")
34                         PID=$(ps ax | grep -i "opensrf system" | grep -v grep | awk '{print $1}');
35
36                         if [ -z "$PID" ]; then
37                                 echo "OpenSRF System is not running";
38                                 exit;
39
40                         else
41                                 echo "Killing System...$PID";
42                                 kill -s INT $PID;
43                         fi
44
45                         echo "Done";
46                         ;;
47         
48                 "status")
49                         PID=$(ps ax | grep -i "opensrf system" | grep -v grep | awk '{print $1}');
50                         if [ -z "$PID" ]; then
51                                 echo "OpenSRF System is not running";
52                                 exit 0;
53                         fi
54                         echo "OpenSRF System is running";
55                         exit 1;
56                         ;;
57         
58                 "restart")
59                         [ -z "$2" ] && usage;
60                         $0 stop;
61                         $0 start $2;
62                         ;;
63                 *)
64                         usage;
65                         ;;
66         esac
67 }
68
69 startSystem $*;
70         
71