码迷,mamicode.com
首页 > 其他好文 > 详细

Debian增加开机启动

时间:2019-12-18 10:53:53      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:sts   The   type   unit   权限   mod   emctl   install   cond   

1、增加服务文件

vi /etc/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

2、增加rc.local文件

vi /etc/rc.local

#!/bin/sh -e

exit 0

添加权限:

chmod +x /etc/rc.local

设置到系统启动:

systemctl enable rc-local

启动脚本:

systemctl start rc-local.service

检查服务状态:

systemctl status rc-local.service

你已经增加了系统启动脚本,可以在这个脚本里面增加你想启动的程序,例如

cd /home/gst/tomcat/bin

./strat.sh

转载于:http://mingli.muhuolong.cn/

Debian增加开机启动

标签:sts   The   type   unit   权限   mod   emctl   install   cond   

原文地址:https://blog.51cto.com/14257289/2459326

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!