Linux:how to add rc.local in Debian 9

Source: Internet
Author: User
Tags exit in

Rc.local is in the old Debian system, and after version 6, this is gone, and here's how Debian 9 sets up the boot script:

New file:

Vi/etc/systemd/system/rc-local.service

Edit content:

[Unit] Description=/etc/rc.localconditionpathexists=/etc/rc.local[service]type=forkingexecstart=/etc/rc.local Starttimeoutsec=0standardoutput=ttyremainafterexit=yessysvstartpriority=99[install]wantedby=multi-user.target

New file:

Vi/etc/rc.local

Content:

#!/bin/sh-e## rc.local## This script was executed at the end of each multiuser runlevel.# make sure that the script would " Exit 0 "On success or any other# value on error.## in order to enable or disable this script just change the execution# bi ts.## By default this script does Nothing.exit 0

  

Add Permissions:

chmod +x/etc/rc.local

Set to System boot:

Systemctl Enable Rc-local

Startup script:

Systemctl Start Rc-local.service

Check Service Status:

Systemctl Status Rc-local.service

Above you have successfully created a system startup script, and the original address is as follows:

Original address: http://www.itechlounge.net/2017/10/linux-how-to-add-rc-local-in-debian-9/

Next you can add any script you want to start in front of the exit in/etc/rc.loacl, such as:

Cd/home/wjf/flypigsh run.sh

  

Linux:how to add rc.local in Debian 9

Related Article

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.