centos7设置开机启动
centos7有多种设置开机启动程序的方法,本文介绍通过自定义服务文件,添加到系统服务的方法。这里以redis为例:
1、vim redis.conf
#改为yes后台运行,如果其它程序没有提供后台运行的参数,可以写一个脚本,用nohup执行这个程序, ExecStart=这个脚本的路径 daemonize yesvim /usr/lib/systemd/system/redis.service
[Unit] Description=The redis-server Process Manager After=syslog.target network.target [Service] Type=forking ExecStart=/usr/local/redis/src/redis-server /usr/local/redis/redis.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target
执行
systemctl enable redis systemctl start redis
2、zookeeper的启动脚本
[Unit] Description=the zookeeper service After=syslog.target network.target [Service] Type=forking ExecStart=/usr/local/zookeeper/bin/zkServer.sh start ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target3、vsftp的启动脚本
[Unit] Description=Vsftpd ftp daemon After=network.target [Service] Type=forking ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target
0
赞
- 所属分类: linux
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦