我已经创建了下面的init.d脚本,以便在Amazon Linux EC2实例上执行我的C#windows服务。我希望亚马逊linux基于fedora linux。
我在init.d脚本下面,然后用Google搜索并找到了脚本。
但如果我使用以下命令启动服务:
sudo service amaziersysd start
我收到以下错误消息:
cat:/tmp/amaziersysd.lock:没有这样的文件或目录
请注意:我是设置单声道的新手,我正在运行从源代码构建的单声道3.2.3。
#!/bin/sh
daemon_name=amaziersysd
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mono/mono-service2
NAME=amaziersysd
DESC=amaziersysd
MONOSERVER=$(which mono-service2)
MONOSERVER_PID=$(cat /tmp/amaziersysd.lock)
case "$1" in
start)
stat_busy "Starting amaziersysd"
if [ -z "${MONOSERVER_PID}" ]; then
${MONOSERVER} -l:/tmp/amaziersysd.lock /etc/amazierlb/sysdaemon/Amazier.CollectSysStat.exe
stat_done
else
echo "amaziersysd is already running!"
stat_fail
fi
;;
stop)
stat_busy "Stopping amaziersysd"
if [ -n "${MONOSERVER_PID}" ]; then
kill ${MONOSERVER_PID}
rm /tmp/amaziersysd.lock
stat_done
else
echo "amaziersysd is not running"
stat_fail
fi
;;
restart)
$0 stop
sleep 1
$0 start
stat_done
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0