10 if [ -f `dirname $0`/..
/script
/owp
]; then
11 INSTALL_DIR
=`dirname $0`/..
/
13 INSTALL_DIR
="/opt/ovz-web-panel"
19 LOCK_FILE
=/var
/lock
/owp
21 [ -f /etc
/owp.conf
] && .
/etc
/owp.conf
24 if [ -f /proc
/vz
/version
]; then
27 ENVIRONMENT
="STANDALONE"
32 if [ -f $LOCK_FILE ]; then
33 stat_fail
"OpenVZ Web Panel is already running!"
35 stat_busy
"Starting OpenVZ Web Panel Server"
36 $ruby $INSTALL_DIR/utils
/watchdog
/watchdog.rb start
&>>$LOG
37 if [ "x$SSL" = "xon" ]; then
38 $ruby $INSTALL_DIR/script
/server_ssl webrick
-e production
-p $PORT -b $IP -d &>>$LOG
40 $ruby $INSTALL_DIR/script
/server webrick
-e production
-p $PORT -b $IP -d &>>$LOG
42 [ "$ENVIRONMENT" = "HW-NODE" ] && $ruby $INSTALL_DIR/utils
/hw-daemon
/hw-daemon.rb start
&>>$LOG && \
44 sleep 1 # wait a little for forked processes
45 echo "Syncing physical servers state..." &>>$LOG
46 $ruby $INSTALL_DIR/script
/runner
-e production
"HardwareServer.all.each { |server| server.sync }" &>>$LOG
47 if [ -f $LOCK_FILE ]; then
57 stat_busy
"Stopping OpenVZ Web Panel server"
58 PANEL_APP_PID
=`ps auxww | grep $ruby | grep script/server | awk '{ print $2 }'`
59 [ -n "$PANEL_APP_PID" ] && kill -2 $PANEL_APP_PID
60 [ "$ENVIRONMENT" = "HW-NODE" ] && $ruby $INSTALL_DIR/utils
/hw-daemon
/hw-daemon.rb stop
&>>$LOG && \
61 $ruby $INSTALL_DIR/utils
/watchdog
/watchdog.rb stop
&>>$LOG && \
63 if [ ! -f $LOCK_FILE ]; then
72 $ruby $INSTALL_DIR/utils
/watchdog
/watchdog.rb status
74 if [ -f $LOCK_FILE ]; then
75 echo "OpenVZ Web Panel is running!"
78 echo "OpenVZ Web Panel is NOT running!"
95 restart|reload|condrestart
)
100 echo $
"Usage: $0 {start|stop|restart|reload|status}"