Living a Simple Life is a Happy Life

有饭吃,自由自在,就非常开心

Enable /etc/rc.local With Systemd on Ubuntu 20.04

| Comments

setup systemd service file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo vi /etc/systemd/system/rc-local.service


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

enable systemd service

1
sudo systemctl enable rc-local

create rc.local

1
2
3
4
5
6
7
sudo vi /etc/rc.local

#!/bin/bash
...


sudo chmod +x /etc/rc.local

Comments