创建server 管理脚本

简介:
#!/bin/bash
#
# chkconfig:     2345 20 80
# description: autoruntest
# processname:         /etc/rc.d/init.d/sysm
 
EXEC_PATH=/root/project/sys_monitor
EXEC=sysm
PID_FILE=/var/run/sysm.pid
DAEMON=ps   ax |grep java |awk '{print   $1}'
 
# Source function library.
. /etc/rc.d/init.d/functions
 
if ! [ -x $EXEC_PATH/$EXEC ] ; then
             echo  "ERROR: $EXEC_PATH/$EXEC not found"
             exit 1
fi
 
stop()
{
             echo  "Stoping $EXEC ..."
             killall $DAEMON >/dev/ null
             usleep 100
             echo  "Shutting down $EXEC: [    OK    ]"            
}
 
start()
{
             echo  "Starting $EXEC ..."
             $DAEMON > /dev/ null &
             usleep 100
             echo  "Starting $EXEC: [    OK    ]"                 
}
 
restart()
{
             stop
             start
}
 
 
case  "$1"  in
             start)
             start
             ;;
             stop)
             stop
             ;;
             restart)
             restart
             ;;
             status)
             status -p $PID_FILE $DAEMON    
             ;;        
    *)
             echo  "Usage: service $EXEC {start|stop|restart|status}"
             exit 1
esac
 
exit $?


     本文转自 珏石头 51CTO博客,原文链接:http://blog.51cto.com/gavinshaw/305626,如需转载请自行联系原作者



相关文章
|
自然语言处理 Java
CoreNLP server的开启与使用方法
Ubuntu20.04.2系统本身不含有JDK,而CoreNLP需要依赖JDK进行运行,所以需要先安装好JDK,可以输入java,然后系统会自动提示没有安装JDK,并会推荐安装的版本
218 0
visualsvn server 提交修改日志
修改日志时遇到以下错误: Repository has not been enabled to accept revision propchanges;ask the administrator to create a pre-revprop-change hook 解决办法如下: 同一,在某个库的属性页面的Hooks选项卡下找到Pre-revision property change hook,双击修改其内容。
1920 0
|
Windows 数据安全/隐私保护 网络协议