Seaweedfs-启动脚本
#!/bin/bash
if [ ! -e /sunlight/shell/main.sh ];then
echo " [ Error ] file /sunlight/shell/main.sh does not exist!"
exit 1
fi
if [ ! -e /usr/local/sunlight/weed ];then
echo " [ Error ] /usr/local/sunlight/weed does not exist!"
exit 1
fi
chmod +x /usr/local/sunlight/weed
source /sunlight/shell/main.sh
send_info "pkill all weed processes......"
pkill -9 /usr/local/sunlight/weed
send_info "check directory /var/weedfs......"
if [ ! -d /var/weedfs ];then
mkdir /var/weedfs
fi
send_info "check directory /var/log/sweed......"
if [ ! -d /var/log/sweed ];then
mkdir /var/log/sweed
chmod 755 /var/log/sweed
fi
send_info "begin to init weedfs process......"
nohup /usr/local/sunlight/weed -log_dir=/var/log/sweed/ server -ip 172.16.130.42 -dataCenter sunlightDataCenter -rack sunlightRack01 \
-master.port=9333 -master.defaultReplicaPlacement=002 -dir=/var/weedfs -volume.port=8180 -volume.max=10 -volume.publicUrl=172.16.130.115:8180\
-master.peers=172.16.130.41:9333,172.16.130.40:9333 >> /var/log/sweed/sweed_init.log 2>&1 &
if [ $? -eq 0 ];then
send_success "congratulate! seaweedfs is running!"
ps -ef | grep weed | grep -v grep
exit 0
else
send_error "seaweedfs init failed! Please check it!"
exit 1
fi