Fedora 21 sets the boot script

Source: Internet
Author: User

Fedora 21 sets the boot script

Fedora 21 sets the boot script

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

Write in the/etc/rc. d/rc. local file, and then save and exit with the: wq command.

#! /Bin/bash

# Write the command to be executed during startup in this file

Grant executable permissions:

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

Set boot start:

Sudo systemctl enable rc-local.service

If the following error message is displayed:

[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

Add at the end of the rc-local.service file:

[Install]
Wantedbypolicmulti-user.tar get

And re-set the boot start:

Sudo systemctl enable rc-local.service

Check the status. If the following prompt is displayed, the setting is successful!

[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; 1 h 44 min ago

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.