树莓派开机启动

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 <ejad@debian.org>
# LSB 3.0 compilance and enhancements by Filippo Giunchedi <filippo@debian.org>
#
# Updated for bluez 4.7 by Mario Limonciello <mario_limonciello@dell.com>
# Updated for bluez 5.5 by Nobuhiro Iwamatsu <iwamatsu@debian.org>
#
# Note: older daemons like dund pand hidd are now shipped inside the
# bluez-compat package

PIDFILE=/var/tmp/tpl.pid

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

python -u /home/pi/py/TPL.py >> /home/pi/py/log${fdate}.log  & echo $! > $PIDFILE &

  ;;
  stop)
	pid=$(cat $PIDFILE)
	kill -9 ${pid}  
	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  

posted @ 2019-05-23 17:09  ahuo  阅读(212)  评论(0编辑  收藏  举报