树莓派开机启动

vi /etc/init.d/sss

#! /bin/sh
### BEGIN INIT INFO
# Provides: tpl
# Required-Start:    $local_fs $syslog $remote_fs dbus
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start tpl daemons
### END INIT INFO
#
# bluez    Bluetooth subsystem starting and stopping
#
# originally from bluez's scripts/bluetooth.init
#
# Edd Dumbill <[email protected]>
# LSB 3.0 compilance and enhancements by Filippo Giunchedi <[email protected]>
#
# Updated for bluez 4.7 by Mario Limonciello <[email protected]>
# Updated for bluez 5.5 by Nobuhiro Iwamatsu <[email protected]>
#
# Note: older daemons like dund pand hidd are now shipped inside the
# bluez-compat package

 
case $1 in
  start)
	  fdate=$(date +%Y%m%d)

su pi -c "nohup python -u /home/pi/py/TPL.py >>/home/pi/py/log${fdate}.log &"
  ;;
  stop)
	log_daemon_msg "Stopping tpl"
	log_end_msg 0
  ;;
  restart|force-reload)
	$0 stop
	sleep 1
	$0 start
  ;;
  status)
	status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $?
  ;;
  *)
	N=/etc/init.d/tpl
	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
	exit 1
	;;
esac

exit 0

# vim:noet

  

sudo update-rc.d   sss defaults  

猜你喜欢

转载自www.cnblogs.com/ahuo/p/10913079.html