$vim /etc/init.d/temp2file_luncher.sh

#!/bin/bash
# chkconfig: 2345 66 36
# /usr/bin/python
#
case "$1" in
  start)
        echo -n "Start: "
        su root -c "nohup python /home/pi/Running/temp2file.py &"
        echo "Done."
        ;;
  stop)
        echo -n "Stop: "
        killall -9 temp2file.py
        echo "Done."
        ;;
  *)
  echo "Usage: python { start | stop  }"
  exit 1
esac
exit 0


$chkconfig --add temp2file_luncher.sh

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐