当前位置: 技术问答>linux和unix
求助:linux程序-->服务
来源: 互联网 发布时间:2017-01-18
本文导语: 现在我写了一个c++程序,生成了可执行文件。我想把它搞成服务,怎么做呢? | 网上资料多的是,给你找了两篇: http://www.diybl.com/course/6_system/linux/Linuxjs/2008810/135558.html http://54min.com/post/how-linu...
现在我写了一个c++程序,生成了可执行文件。我想把它搞成服务,怎么做呢?
|
网上资料多的是,给你找了两篇:
http://www.diybl.com/course/6_system/linux/Linuxjs/2008810/135558.html
http://54min.com/post/how-linux-started-configure-services.html
http://www.diybl.com/course/6_system/linux/Linuxjs/2008810/135558.html
http://54min.com/post/how-linux-started-configure-services.html
|
[root@RHEL6A scripts]# vim s7.sh
[root@RHEL6A scripts]# more s7.sh
#!/bin/bash
while [ $# -gt 0 ]; do
case $1 in
start)
echo 'process starting...'
exit 0
;;
stop)
echo 'process stoping...'
exit 0
;;
*)
echo "Internal Error: option processing error: $1" 1>&2
exit 1
;;
esac
done
[root@RHEL6A scripts]# chmod u+x s7.sh
[root@RHEL6A scripts]# ./s7.sh start
process starting...
[root@RHEL6A scripts]#