首页 > 其他 > 详细

systemd设置rc.local开机启动

时间:2015-03-09 01:54:31      阅读:530      评论:0      收藏:0      [点我收藏+]

systemd 里有 rc-local.service ,只需要再写一个 rc.local 的脚本即可。

1、编辑 /usr/lib/systemd/system/rc-local.service 文件:

[Unit]

Description=/etc/rc.d/rc.local Compatibility

After=network.target

 

[Service]

Type=forking

ExecStart=/etc/rc.d/rc.local start

TimeoutSec=0

RemainAfterExit=yes

SysVStartPriority=99


[Install]

WantedBy=multi-user.target


其中 Install 那部分是自己写的,multi-user.target 代表3级别,graphical.target 代表5级别。


2、编辑 /etc/rc.d/rc.local 文件:

# cat /etc/rc.d/rc.local

#!/bin/bash

xxxxxxxxxx 代表自定义内容,设置开机启动


3、给 /etc/rc.d/rc.local 可执行权限:

#chmod +x /etc/rc.d/rc.local

4、开启 rc-local.service 服务:

#systemctl   enable   rc-local.service

#systemctl   --system  daemon-reload

#systemctl   start  rc-local.service


本文出自 “myway” 博客,请务必保留此出处http://cakong.blog.51cto.com/794290/1618364

systemd设置rc.local开机启动

原文:http://cakong.blog.51cto.com/794290/1618364

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!