zoukankan      html  css  js  c++  java
  • Fedora 21 设置开机启动脚本

    sudo touch /etc/rc.d/rc.local
    sudo vim /etc/rc.d/rc.local

    在/etc/rc.d/rc.local文件中写入, 然后使用:wq命令 保存并退出.

    #!/bin/bash

      # 在这个文件中写入开机启动需要执行的命令

    赋予可执行权限:

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

    设置开机启动:

    sudo systemctl enable rc-local.service

    如果出现以下错误提示:

    [root@dev-zhanghua ~]# systemctl enable rc-local.service
    The unit files have no [Install] section. They are not meant to be enabled
    using systemctl.
    Possible reasons for having this kind of units are:
    1) A unit may be statically enabled by being symlinked from another unit's
       .wants/ or .requires/ directory.
    2) A unit's purpose may be to act as a helper for some other unit which has
       a requirement dependency on it.
    3) A unit may be started when needed via activation (socket, path, timer,
       D-Bus, udev, scripted systemctl call, ...).
    sudo vim /usr/lib/systemd/system/rc-local.service

    在rc-local.service文件末尾加入:

    [Install]
    WantedBy=multi-user.target

    并重新设置开机启动:

    sudo systemctl enable rc-local.service

    查看状态, 如果出现以下提示, 设置成功!

    [zhanghua@dev-zhanghua ~]$ systemctl status rc-local.service
    ● rc-local.service - /etc/rc.d/rc.local Compatibility
       Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled)
       Active: active (running) since Wed 2015-04-15 11:37:40 CST; 1h 44min ago
  • 相关阅读:
    C# 复制文件夹,移动文件夹
    让Base64适合在URL中使用
    修复FIREBIRD数据库
    Image.FromFile 锁文件的解决办法
    Powerbuilder 12.5 下载地址
    C# 给程序添加许可
    WIN FORM 多线程更新UI(界面控件)
    .Net WinForm 拖动控件
    SQL Server 自动增长清零
    C# 一次生成多个相同的字符
  • 原文地址:https://www.cnblogs.com/inthedark/p/4428255.html
Copyright © 2011-2022 走看看