linux 开机自启

cd /home/dpf

1.vi startup.sh

#!/bin/sh
echo "hello world" >> /home/dpf/test.txt
 
vi mqtt.sh

#!/bin/sh
/home/dpf/Desktop/Udp_Single_Async_Mqtt_yuan/hwjc_udp_receive_mqtt &

2.cd /etc/rc.d/rc.local

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/home/dpf/mqtt.sh &
/home/dpf/startup.sh


原文地址:https://www.cnblogs.com/dpf-learn/p/7891944.html