百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> Arch linux操作系统设置开机启动配置
分享文章到:

Arch linux操作系统设置开机启动配置

发布时间:01/15 来源: 浏览: 关键词:
Arch linux操作系统的安装与网络配置一聚教程小编都有为各位介绍过了,在这里一聚教程小编再为各位介绍Arch linux操作系统设置开机启动配置步骤,希望文章能够帮助到大家。


顺便说一下Centos 7 中rc.local其实依然是可以使用的,无法使用的原因是由于/etc/rc.d/rc.local中没有X权限,增加一个执行权限即可。

既然centos中的可以使用,哪么arch linux中其实也是可以使用的。直接copycentos中的资料即可。

[root@Arch ~]# egrep -v "#" /usr/lib/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
[root@Arch ~]# touch /etc/rc.local
[root@Arch ~]# chmod +x /etc/rc.local
[root@Arch ~]# systemctl enable rc-local.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rc-local.service to /usr/lib/systemd/system/rc-local.service.
[root@Arch ~]# cat /etc/rc.local
ulimit -HSn 30961 && echo 'right' >>/tmp/right.txt || echo 'wrong' >>/tmp/wrong.txt
printf $(ulimit -n) >>/tmp/ulimit1.txt 2>&1
ulimit -HSn 3096
printf $(ulimit -n) >>/tmp/ulimit.txt 2>&1

测试:

[root@Arch ~]# ls -al /usr/lib/systemd/system/rc-local.service
-rw-r--r-- 1 root root 675 Apr  5 23:24 //usr/lib/systemd/system/rc-local.service
[root@Arch ~]# chmod +x /usr/lib/systemd/system/rc-local.service
[root@Arch ~]# ls -al /usr/lib/systemd/system/rc-local.service
-rwxr-xr-x 1 root root 675 Apr  5 23:24 //usr/lib/systemd/system/rc-local.service
[root@Arch ~]# systemctl start rc-local.service
Job for rc-local.service failed. See "systemctl status rc-local.service" and "journalctl -xe" for details.
[root@Arch ~]# systemctl status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2015-04-05 23:30:27 UTC; 9s ago
  Process: 246 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)
Apr 05 23:30:27 Arch systemd[1]: rc-local.service: control process exited, code=exited status=203
Apr 05 23:30:27 Arch systemd[1]: Failed to start /etc/rc.local Compatibility.
Apr 05 23:30:27 Arch systemd[1]: Unit rc-local.service entered failed state.
Apr 05 23:30:27 Arch systemd[1]: rc-local.service failed.
[root@Arch ~]# ls -al /usr/lib/systemd/system/sshd.service     #排除权限原因
-rw-r--r-- 1 root root 410 Mar 20 04:52 /usr/lib/systemd/system/sshd.service
[root@Arch ~]# journalctl -xe
Apr 05 23:29:34 Arch systemd[1]: Configuration file /usr/lib/systemd/system/rc-local.service is marked executable. Please remove exec
Apr 05 23:29:38 Arch systemd[1]: rc-local.service: control process exited, code=exited status=203
-- Subject: Unit rc-local.service has failed
-- Unit rc-local.service has failed.
Apr 05 23:29:38 Arch systemd[1]: Unit rc-local.service entered failed state.
Apr 05 23:29:38 Arch systemd[1]: rc-local.service failed.
[root@Arch ~]# systemctl start rc-local.service
Warning: Unit file of rc-local.service changed on disk, 'systemctl daemon-reload' recommended.
Job for rc-local.service failed. See "systemctl status rc-local.service" and "journalctl -xe" for details.
[root@Arch ~]# systemctl | grep rc-loca
rc-local.service                                                                    loaded active exited    /etc/rc.local Compatibility
[root@Arch ~]# cat /etc/rc.local
#!/bin/sh
[root@Arch ~]# egrep -v "#" /etc/systemd/system/multi-user.target.wants/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target

rc.loca在Arch中无法启动的原因是由于我在rc.loca中没有设置#!/bin/sh导致的!!!

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有8人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板