要在CentOS系统上设置开机自动启动EasyDarwin服务
首先,确保EasyDarwin服务已经安装并配置好了。
使用root权限登录CentOS系统。
打开终端,输入以下命令来编辑EasyDarwin服务的启动脚本:
sudo vi /etc/init.d/easydarwin
在打开的编辑器中,输入以下内容作为EasyDarwin服务的启动脚本:
#!/bin/sh## EasyDarwin: Start/Stop the EasyDarwin daemon.## chkconfig: 345 95 5# description: EasyDarwin is a lightweight and high-performance streaming server#### BEGIN INIT INFO# Provides: EasyDarwin# Required-Start: $network $local_fs $remote_fs# Required-Stop: $network $local_fs $remote_fs# Default-Start: 3 4 5# Default-Stop: 0 1 2 6# Short-Description: start and stop EasyDarwin# Description: EasyDarwin is a lightweight and high-performance streaming server### END INIT INFO# Source function library.. /etc/rc.d/init.d/functions prog=easydarwin exec=/usr/local/easydarwin/easydarwin [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog lockfile=/var/lock/subsys/$prog start() { echo -n $"Starting $prog: " daemon $exec RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status $prog ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart|status}" exit 1 esac exit $?
保存并退出编辑器,然后输入以下命令来设置EasyDarwin服务的启动脚本为可执行文件:
sudo chmod +x /etc/init.d/easydarwin
最后,使用以下命令来设置EasyDarwin服务开机自动启动:
sudo chkconfig easydarwin on
现在,EasyDarwin服务将会在CentOS系统启动时自动启动。您可以使用以下命令来手动启动、停止或查看EasyDarwin服务的状态:
启动:
sudo service easydarwin start
停止:
sudo service easydarwin stop
查看状态:
sudo service easydarwin status
0