Autostart Service Configuration
Configuration Using the rc.local Service
rc.local is a system service used to automatically execute scripts or commands during system startup. This service is invoked automatically when the system boots up, and runs user-specified scripts or commands after the system startup is complete, enabling custom configurations or operations at boot time.
This can be achieved by adding startup commands to the end of the sudo vim /etc/rc.local file, for example:
shell
#!/bin/bash
# by tinch for startup
/bin/mount -n -o remount,suid /
chmod 777 /tmp
nohup sh -c 'sleep 10 &&
if grep -q "Generated by resolvconf" "/etc/resolv.conf"; then
echo "nameserver 223.6.6.6
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 114.114.114.114" > /etc/resolv.conf
fi' > /dev/null 2>&1 &
if [ -d /etc/aidlux ]; then
if [ -f /etc/aidlux/oom ]; then
rm /etc/aidlux/oom
fi
for e in $(ls /etc/aidlux); do
chmod 775 "/etc/aidlux/$e"
nohup "/etc/aidlux/$e" >/var/log/startlog 2>&1 &
done
fi
echo "test_autostart" > /home/aidlux/test.logSimply add the scripts or commands to be executed at the end of the file.