8 ม.ค. 2563

rc.local on Ubuntu 18.04

Create file
vi /etc/systemd/system/rc-local.service


Add
[Unit]
Description=Start up script
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

 Create file /etc/rc.local with
#!/bin/bash

touch /root/OK

exit 0

Make it executable with
 chmod 755 /etc/rc.local

Reload systemd
 systemctl daemon-reload

 Enable the service
 systemctl enable sok-startup.service

ไม่มีความคิดเห็น:

แสดงความคิดเห็น