리눅스 (Raspbian on Raspberry PI)에서 파이썬 프로그램 (그래픽 사용자 인터페이스)을 시작하고 싶습니다.부팅시 파이썬 스크립트 리눅스
필자는 파이썬 프로그램을 시작하기 위해 initscript를 만들었고이를 etc/init.d 맵에 넣었습니다.
나는 그것을 update-rc.d 명령으로 사용 가능하게했다. 그것은 모두 잘 작동합니다.
하지만 내 파이썬 스크립트는 초기화 스크립트에 다음 코드로 시작되지 않습니다
#!/bin/bash
### BEGIN INIT INFO
# Provides: GUI
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This is a test daemon
# Description: This is a test daemon
# This provides example about how to
# write a Init script.
### END INIT INFO
case $1 in
start)
python3 /home/pi/Desktop/GUI/GUI.py
;;
stop)
# Stop the daemon.
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE $DAEMON "Stoppping the $NAME process" && status="0" || status="$?"
if [ "$status" = 0 ]; then
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
/bin/rm -rf $PIDFILE
fi
else
log_daemon_msg "$NAME process is not running"
log_end_msg 0
fi
;;
restart)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
;;
status)
# Check the status of the process.
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE $DAEMON "$NAME process" && exit 0 || exit $?
else
log_daemon_msg "$NAME Process is not running"
log_end_msg 0
fi
;;
reload)
# Reload the process. Basically sending some signal to a daemon to reload
# it configurations.
if [ -e $PIDFILE ]; then
start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE --name $NAME
log_success_msg "$NAME process reloaded successfully"
else
log_failure_msg "$PIDFILE does not exists"
fi
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
esac
에게'서비스 --status를 ~/.xinitrc에
에 GUI 응용 프로그램을 시작하고 시작하려면 명령 줄을 추가 - 모든 결과가 있습니까? –