]> git.evergreen-ils.org Git - OpenSRF.git/blob - bin/opensrf_ctl
Initial revision
[OpenSRF.git] / 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
9 case $1 in 
10         "start")
11                 perl -MOpenILS::System -e 'OpenILS::System->bootstrap()' & 
12                 sleep 2;
13                 $0 status;
14                 echo;
15                 ;;
16         "stop")
17                 PID=$(ps ax | grep "[0-9] System$" | awk '{print $1}');
18                 if [ -z $PID ]; then
19                         echo "OpenILS System is not running";
20                         exit;
21                 fi
22                 echo "Killing System...$PID";
23                 kill -s INT $PID;
24                 echo "Done";
25                 ;;
26         "status")
27                 PID=$(ps ax | grep "[0-9] System$" | awk '{print $1}');
28                 if [ -z $PID ]; then
29                         echo "OpenILS System is not running";
30                         exit 0;
31                 fi
32                 echo "OpenILS System is running";
33                 exit 1;
34                 ;;
35         "restart")
36                 $0 stop;
37                 $0 start;
38                 ;;
39         *)
40                 echo "usage: system.sh [start|stop|restart|status]";
41                 ;;
42 esac
43
44