ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20201112]centos 7 rc.local shell script on systemd while booting Linux system.t

[20201112]centos 7 rc.local shell script on systemd while booting Linux system.t

原创 Linux操作系统 作者:lfree 时间:2020-11-12 10:38:54 0 删除 编辑

[20201112]centos 7 rc.local shell script on systemd while booting Linux system.txt

--//centos 7开始全面使用systemd管理启动过程,说真的我自己非常不习惯,也许是老了,接受新生事物有点迟钝。
--//而以前用户要加入一些特殊命令一般都是选择/etc/rc.d/rc.local.但是centos 7开始不会再调用执行。

# ls -l /etc/rc.local /etc/rc.d/rc.local
-rw-r--r--. 1 root root 485 2020-11-12 10:28:16 /etc/rc.d/rc.local
lrwxrwxrwx. 1 root root  13 2020-02-27 01:51:51 /etc/rc.local -> rc.d/rc.local

# systemctl status rc-local.service
* rc-local.service - /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
   Active: inactive (dead)

# systemctl enable rc-local.service

# systemctl start rc-local.service

# systemctl status rc-local.service
* rc-local.service - /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at Thu 2020-11-12 10:34:12 CST; 3s ago
           ConditionFileIsExecutable=/etc/rc.d/rc.local was not met
--//不行。

# ls -l /etc/rc.d/rc.local
-rw-r--r--. 1 root root 485 2020-11-12 10:28:16 /etc/rc.d/rc.local
--//没有执行权限。

# chmod 744 /etc/rc.d/rc.local

# systemctl start rc-local.service

# systemctl status rc-local.service
* rc-local.service - /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
   Active: active (exited) since Thu 2020-11-12 10:36:05 CST; 1s ago
  Process: 8078 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)

Nov 12 10:36:05 localhost.localdomain systemd[1]: Starting /etc/rc.d/rc.local Compatibility...
Nov 12 10:36:05 localhost.localdomain rc.local[8078]: test
Nov 12 10:36:05 localhost.localdomain systemd[1]: Started /etc/rc.d/rc.local Compatibility.

--//ok现在已经执行成功了。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2733684/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969289