7 CP_DIR
=`cat $KFS_CONF 2>/dev/null | grep metaServer.cpDir | cut -d '=' -f 2 | sed 's/ //g'`
8 LOG_DIR
=`cat $KFS_CONF 2>/dev/null | grep metaServer.logDir | cut -d '=' -f 2 | sed 's/ //g'`
12 stat_busy
"Starting KFS MetaServer"
14 [ -z "$KFS_CONF" ] && { echo "KFS_CONF not set. You need to specify it in /etc/conf.d/kfs file"; stat_fail
; exit 0; }
15 [ -z "$KFS_WEBUI_CONF" ] && { echo "KFS_WEBUI_CONF not set. You need to specify it in /etc/conf.d/kfs file"; stat_fail
; exit 0; }
16 [ -z "$KFS_DIR" ] && { echo "KFS_DIR not set. You need to specify it in /etc/conf.d/kfs file"; stat_fail
; exit 0; }
18 [ -f "$KFS_CONF" ] ||
{ echo "$KFS_CONF doesn't exist"; stat_fail
; exit 0; }
19 [ -f "$KFS_WEBUI_CONF" ] ||
{ echo "$KFS_WEBUI_CONF doesn't exist"; stat_fail
; exit 0; }
21 [ -d "$KFS_DIR" ] || mkdir
-p "$KFS_DIR" ||
{ echo "Could not create $KFS_DIR"; stat_fail
; exit 0; }
23 [ -z "$CP_DIR" ] && { echo "$KFS_CONF doesn't have metaServer.cpDir set"; stat_fail
; exit 0; }
24 [ -z "$LOG_DIR" ] && { echo "$KFS_CONF doesn't have metaServer.logDir set"; stat_fail
; exit 0; }
28 [ -d "$CP_DIR" ] || mkdir
-p "$CP_DIR" ||
{ echo "Could not create $CP_DIR directory"; stat_fail
; exit 0; }
29 [ -d "$LOG_DIR" ] || mkdir
-p "$LOG_DIR" ||
{ echo "Could not create $LOG_DIR directory"; stat_fail
; exit 0; }
31 [ -d "bin" ] ||
ln -s /usr
/share
/kfs
/bin ||
{ echo "Could not create link to /usr/share/kfs/bin in $KFS_DIR"; stat_fail
; exit 0; }
32 [ -d "scripts" ] ||
ln -s /usr
/share
/kfs
/scripts ||
{ echo "Could not create link to /usr/share/kfs/scripts in $KFS_DIR"; stat_fail
; exit 0; }
33 [ -d "logs" ] || mkdir
-p "logs" ||
{ echo "Could not create $KFS_DIR/logs"; stat_fail
; exit 0; }
35 if [ ! -d "webui" ]; then
36 mkdir
-p "webui" ||
{ echo "Could not create webui directory in $KFS_DIR"; stat_fail
; exit 0; }
37 ( cd webui
&& ln -s /usr
/share
/kfs
/webui
/kfsstatus.py
) ||
{ echo "Could not create link to /usr/share/kfs/webui/kfsstatus.py in $KFS_DIR/webui"; stat_fail
; exit 0; }
38 ( cd webui
&& ln -s /usr
/share
/kfs
/webui
/files
) ||
{ echo "Could not create link to /usr/share/kfs/webui/files in $KFS_DIR/webui"; stat_fail
; exit 0; }
39 ( cd webui
&& ln -s "$KFS_WEBUI_CONF" server.conf
) ||
{ echo "Could not create link to $KFS_WEBUI_CONF in $KFS_DIR/webui"; stat_fail
; exit 0; }
42 [ -d "$KFS_DIR/webui/files" ] ||
{ echo "$KFS_DIR/webui/files doesn't exist or is not a directory"; stat_fail
; exit 0; }
43 [ -e "$KFS_DIR/webui/kfsstatus.py" ] ||
{ echo "$KFS_DIR/webui/kfsstatus.py exist"; stat_fail
; exit 0; }
44 [ -e "$KFS_DIR/webui/server.conf" ] ||
{ echo "$KFS_DIR/webui/server.conf doesn't exist"; stat_fail
; exit 0; }
46 if [ -z "$BACKUP_NODE" ]; then
47 scripts
/kfsrun.sh
--start --meta --file "$KFS_CONF"
51 [ -z "$BACKUP_PATH" ] && BACKUP_PATH
="."
53 # Needed? I'm not sure how backup_path works...
54 mkdir
-p "$BACKUP_PATH" ||
{ echo "Could not create $BACKUP_PATH directory"; stat_fail
; exit 0; }
56 echo "Running with BACKUP_NODE=$BACKUP_NODE and BACKUP_PATH=$BACKUP_PATH"
58 scripts
/kfsrun.sh
--start --meta --file "$KFS_CONF" --backup_node "$BACKUP_NODE" --backup_path "$BACKUP_PATH"
63 if [ $ret -gt 0 ]; then
66 add_daemon kfs-metaserv
71 stat_busy
"Stopping KFS MetaServer"
75 if [ -z "$BACKUP_NODE" ]; then
76 scripts
/kfsrun.sh
--stop --meta --file "$KFS_CONF"
80 [ -z "$BACKUP_PATH" ] && BACKUP_PATH
="."
82 scripts
/kfsrun.sh
--stop --meta --file "$KFS_CONF" --backup_node "$BACKUP_NODE" --backup_path "$BACKUP_PATH"
87 if [ $ret -gt 0 ]; then
90 rm_daemon kfs-metaserv
100 echo "usage: $0 {start|stop|restart}"