Debian 10 secara resmi menghapus file rc.local yang biasanya kita gunakan untuk melakukan inisiasi program atau script saat booting secara otomatis. Nah, untuk mengakali hal itu, kita bikin rc.local sendiri dengan membuat systemd unit baru yang menjalankan rc.local tersebut.
Silakan ikuti tutorial berikut:
- Buat file systemd unit dengan contoh
[Unit]
Description=/etc/rc.local
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
simpan dengan nama
/etc/systemd/system/rc-local.service
- lalu bikin file rc.local baru, di /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
- Buat file rc.local menjadi executable dengan perintah chmod +x /etc/rc.local
- Enable systemd unit dari rc.local dengan systemctl enable rc-local
- Start rc-local dengan systemctl start rc-local
Selamat mencoba!