So starten Sie eine Node.js app auf system-boot?

Arbeite ich an einem Raspberry Pi läuft Raspbian läuft ein Node.js app und zu versuchen, es zu starten, wenn der Pi hochfährt. Ich fand ein paar Beispiele, aber ich kann nicht scheinen, um es funktioniert. Mein aktuelle code:

#! /bin/sh
# /etc/init.d/MyApp

### BEGIN INIT INFO
# Provides:          MyApp.js
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts MyApp.js
# Description:       Start / stop MyApp.js at boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
   start)
    echo "Starting MyApp.js"
    # run application you want to start
    node /home/pi/app/MyApp/MyApp.js
   ;;
   stop)
    echo "Stopping MyApp.js"
    # kill application you want to stop
    killall MyApp.js
    ;;
  *)
    echo "Usage: /etc/init.d/MyApp {start|stop}"
    exit 1
    ;;
esac

exit 0

Habe ich diese in der etc/init.d Ordner, lief chmod +x /etc/init.d/MyApp ich bin in der Lage, es manuell ausführen, dann Lauf ich sudo update-rc.d MyApp defaults starten und das Skript läuft nicht. Ich habe mir einige andere Beispiele, Anpassungen und immer noch kein Glück.

InformationsquelleAutor user2650875 | 2014-02-04
Schreibe einen Kommentar