sh 一种简单而丑陋的方式来启动和停止进程 - 1. proc start script

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 一种简单而丑陋的方式来启动和停止进程 - 1. proc start script相关的知识,希望对你有一定的参考价值。

#!/bin/sh

# A quick, dirty script for starting a process  
# Works at least for bash 4.2.25(1)-release (x86_64-pc-linux-gnu)
# Don't forget to assign a proper previledge to this file
# Usage: proc_start.sh
# proc_stop.sh @ https://gist.github.com/photonxp/326739675882076166c047b2b96e9faa

proc_name=proc.name
daemon=/absolute/path/to/$proc_name
pidpath=/tmp/redsocks.pid
user="uname:ugroup"
#For some reason, $cmd doesn't work for this command, which leads to writing extra bizarre file to the directory. 
touch $pidpath || exit  
echo "touch $pidpath || exit"  
chown $user $pidpath
echo "chown $user $pidpath"
confpath=/absolute/path/to/proc_name.conf

echo "Starting $proc_name ..."
$daemon -c $confpath -p $pidpath
echo "$daemon -c $confpath -p $pidpath"

echo "Start script done ..."

以上是关于sh 一种简单而丑陋的方式来启动和停止进程 - 1. proc start script的主要内容,如果未能解决你的问题,请参考以下文章

09_Hadoop启动或停止的三种方式及启动脚本

linux 如何启动,停止,查看服务

linux下如何启动和关闭weblogic

Hadoop的启动和停止说明

tomcat启动进程突然停止无错误日志输出

Linux下启动停止查看杀死Tomcat进程