set_rasp_pi_rc_local_in_boot

to set a rc.local for pi

*********************/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.# Print the IP address_IP=$(hostname -I) || trueif [ "$_IP" ]; then printf "My IP address is %s
"
"$_IP"fi/bin/su - pi -c "bash /boot/bak_script/jd_rc.local"exit 0

the set up :

*********************jd_rc.local*********************#!bash# cd `dirname `readlink -f $0``logfile=/home/pi/jd/t/jd_rc.local.log# /home/pi/jd/t/jd_rc.local.logdate_=`date "+%Y%m%d_%H%M"`whoami_=`whoami`echo "- $whoami_ power on at $date_" >> $logfileecho "- to run /home/pi/jd/t/ngrok/start_ngrok.sh" >> $logfilesh /home/pi/jd/t/ngrok/start_ngrok.sh &EOF

推薦閱讀:

相关文章