Skip to content

Instantly share code, notes, and snippets.

@juzam
Forked from ImTheDeveloper/Node_Red Init
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save juzam/9002204 to your computer and use it in GitHub Desktop.

Select an option

Save juzam/9002204 to your computer and use it in GitHub Desktop.

Revisions

  1. juzam revised this gist Feb 14, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Node_Red Monit
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    check node-red with pidfile /var/run/nodered.pid
    start program = "/etc/init.d/nodered start"
    stop program = "/etc/init.d/nodered stop"
    start program = "/etc/init.d/node_red start"
    stop program = "/etc/init.d/node_red stop"

    if failed port 1880 protocol HTTP request / with timeout 10 seconds then restart
    if 3 restarts within 5 cycles then timeout
  2. juzam revised this gist Feb 14, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions Node_Red Monit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    check node-red with pidfile /var/run/nodered.pid
    start program = "/etc/init.d/nodered start"
    stop program = "/etc/init.d/nodered stop"

    if failed port 1880 protocol HTTP request / with timeout 10 seconds then restart
    if 3 restarts within 5 cycles then timeout
  3. juzam revised this gist Feb 14, 2014. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Node_Red Init
    Original file line number Diff line number Diff line change
    @@ -10,18 +10,22 @@
    # Short-Description: Node Red
    ### END INIT INFO

    PIDFILE=/var/run/nodered.pid

    #Load up node red when called
    case "$1" in

    start)
    echo "Starting Node-Red.."
    cd /home/pi/node-red
    sudo screen -dmS red node red.js
    echo `screen -ls red | sed -n '2p' | cut -f1 -d.` > $PIDFILE
    ;;

    stop)
    echo "Stopping Node-Red.."
    sudo screen -S red -X quit
    rm $PIDFILE
    ;;

    restart)
  4. @ImTheDeveloper ImTheDeveloper revised this gist Jan 26, 2014. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions Node_Red Init
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,8 @@

    #! /bin/sh
    # Starts and stops node-red
    # /etc/init.d/node_red1
    # /etc/init.d/node_red
    ### BEGIN INIT INFO
    # Provides: node_red1
    # Provides: node_red
    # Required-Start: $syslog
    # Required-Stop: $syslog
    # Default-Start: 2 3 4 5
  5. @ImTheDeveloper ImTheDeveloper created this gist Jan 26, 2014.
    37 changes: 37 additions & 0 deletions Node_Red Init
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@

    #! /bin/sh
    # Starts and stops node-red
    # /etc/init.d/node_red1
    ### BEGIN INIT INFO
    # Provides: node_red1
    # Required-Start: $syslog
    # Required-Stop: $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Node Red
    ### END INIT INFO

    #Load up node red when called
    case "$1" in

    start)
    echo "Starting Node-Red.."
    cd /home/pi/node-red
    sudo screen -dmS red node red.js
    ;;

    stop)
    echo "Stopping Node-Red.."
    sudo screen -S red -X quit
    ;;

    restart)
    echo "Restarting Node-Red.."
    $0 stop
    $0 start
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    esac