Auto Start nach Reboot/Stromausfall

125 views
Skip to first unread message

gneandr

unread,
Nov 17, 2015, 5:27:18 PM11/17/15
to piSch...@googlegroups.com
Um zu gewährleisten, dass piSchedule direkt beim Einschalten bzw. nach einem Stromausfall anläuft gibt es eine gute Anleitung:
http://blog.scphillips.com/posts/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/

Für das automatische Starten installiert das Script install_piSchedule7.sh eine extra Script piSchedule.sh.
Sollte piSchedule nicht automatisch starten, empfiehlt es sich die Schritte gem. der og. Seite nachzuvollziehen. Zu beachten sind diese Script Zeilen
### BEGIN INIT INFO
# Provides:          piSchedule
# Required-Start:    $remote_fs $syslog $all
# Required-Stop:     $remote_fs $syslog
# Should-Start:      pilight
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start|Stop service for piSchedule
# Description:       Start|Stop service for piSchedule
### END INIT INFO

#Change the next 3 lines to suit where you install your script and what you want to call it

DIR=/home/pi/piSchedule7
DAEMON=$DIR/piSchedule.py
DAEMON_NAME=piSchedule
DAEMON_NAME=piSchedule ist nicht piSchedule.sh und als Startvoraussetzung pilight

Siehe in der Anleitung Abschnitt  "Using the init script" .. angepasst für piSchedule:
To actually use this script, put your Python script where you want and make sure it is executable (e.g. chmod 755 myservice.py) and also starts with the line that tells the computer to use the Python interpreter (e.g. #!/usr/bin/env python). Edit the init script accordingly. Copy the init script into /etc/init.d using e.g. sudo cp piSchedule.sh /etc/init.d/piSchedule
Make sure the script is executable (chmod again) and make sure that it has UNIX line-endings. At this point you should be able to start your Python script using the command sudo /etc/init.d/piSchedule start, check its status with the /etc/init.d/piSchedule status argument and stop it with sudo /etc/init.d/piSchedule stop Siehe unten!

WICHTIG!!!
To make the Raspberry Pi use your init script at the right time, one more step is required: running the command
sudo update-rc.d piSchedule defaults. This command adds in symbolic links to the /etc/rc.x directories so that the init script is run at the default times. you can see these links if you do ls -l /etc/rc?.d/*piSchedule

Nun kann piSchedule mit  sudo service piSchedule start|stop|restart|status  kontrolliert werden und beim Reboot/Stromausfall sollte piSchedule automatisch anlaufen.


___________________________________________________
Versionen - piSchedule : 0.7.2.4/DE/ip, pilight : 7.0
piSchedule server:port: 192.168.178.80:5005; INI File: piSchedule.ini
Linux-3.18.11+-armv6l-with-debian-7.8
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 (en-US)
Reply all
Reply to author
Forward
0 new messages