Skip to content

Instantly share code, notes, and snippets.

@bigmonkeyboy
Forked from juzam/Node_Red Init
Last active April 22, 2023 22:08
Show Gist options
  • Save bigmonkeyboy/9962293 to your computer and use it in GitHub Desktop.
Save bigmonkeyboy/9962293 to your computer and use it in GitHub Desktop.

Revisions

  1. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,4 @@ To run it as a single step you can cut paste the following single line command

    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...[^n]

    >is this quoted ?
    [^n]: ref goes here
    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...
  2. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,8 @@ To run it as a single step you can cut paste the following single line command

    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...
    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...[^n]

    >is this quoted ?
    [^n]: ref goes here
  3. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 0 additions and 13 deletions.
    13 changes: 0 additions & 13 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -5,16 +5,3 @@ To run it as a single step you can cut paste the following single line command
    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...


    ```javascript
    var some = "code";
    for { var i=0; i < 10; i++) {
    print "ping";
    }
    ```
    ```Shell
    echo "hello Dave"
    return 0
    ```
  4. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -6,3 +6,15 @@ To run it as a single step you can cut paste the following single line command

    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...


    ```javascript
    var some = "code";
    for { var i=0; i < 10; i++) {
    print "ping";
    }
    ```
    ```Shell
    echo "hello Dave"
    return 0
    ```
  5. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 1 addition and 8 deletions.
    9 changes: 1 addition & 8 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -4,12 +4,5 @@ To run it as a single step you can cut paste the following single line command

    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...
    or click [right-click "save as" this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...


    ###Some code ###

    #!javascript
    function hi(){
    alert('hi!');
    }
  6. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -5,3 +5,11 @@ To run it as a single step you can cut paste the following single line command
    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [this link](https://gist.github.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...


    ###Some code ###

    #!javascript
    function hi(){
    alert('hi!');
    }
  7. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ To run it as a single step you can cut paste the following single line command

    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [this link](https://gist.github.com/bigmonkeyboy/9962293/download) - But please read the script first and satisfy yourself it's safe to execute in your environment...
    or click [this link](https://gist.githubusercontent.com/bigmonkeyboy/9962293/raw/dfeadcf3d9a46dbcc2c5463cbeb13733d697d5cb/nodered) - But please read the script first and satisfy yourself it's safe to execute in your environment...
  8. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,3 +3,5 @@ This gist creates an init.d script to automatically run Node-RED at boot time.
    To run it as a single step you can cut paste the following single line command

    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    or click [this link](https://gist.github.com/bigmonkeyboy/9962293/download) - But please read the script first and satisfy yourself it's safe to execute in your environment...
  9. bigmonkeyboy revised this gist Mar 4, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    This gist creates an init.d script to automatically run Node-RED at boot time.

    To run it as a single step you can cut paste the following single line command

    sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults
  10. bigmonkeyboy revised this gist Mar 1, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ LOG=/var/log/node-red.log
    case "$1" in

    start)
    if pgrep ^node-red$ | grep -v grep > /dev/null
    if pgrep ^node-red$ > /dev/null
    then
    echo "Node-RED already running."
    else
  11. bigmonkeyboy revised this gist Mar 1, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ LOG=/var/log/node-red.log
    case "$1" in

    start)
    if ps aux | grep "node-red" | grep -v '/node-red' | grep -v grep > /dev/null
    if pgrep ^node-red$ | grep -v grep > /dev/null
    then
    echo "Node-RED already running."
    else
  12. bigmonkeyboy revised this gist Mar 1, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@ stop)
    echo "Stopping Node-Red.."
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    pkill -SIGINT ^node-red$
    sleep 2
    echo "" >> $LOG
    echo "Node-RED service stop: "$(date) >> $LOG
  13. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nodered
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ stop)
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    sleep 2
    echo "" >> $LOG
    echo "Node-RED service stop: "$(date) >> $LOG
    ;;
  14. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions nodered
    Original file line number Diff line number Diff line change
    @@ -22,10 +22,10 @@ LOG=/var/log/node-red.log
    case "$1" in

    start)
    if ps aux | grep "node-red" | grep -v '/node-red' | grep -v grep > /dev/null
    then
    echo "Node-RED already running."
    else
    if ps aux | grep "node-red" | grep -v '/node-red' | grep -v grep > /dev/null
    then
    echo "Node-RED already running."
    else
    echo "Starting Node-Red.."
    touch $LOG
    chown $USER:$USER $LOG
    @@ -35,16 +35,16 @@ start)
    # or
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red >> $LOG &"
    echo "Logging to "$LOG
    fi
    fi
    ;;

    stop)
    echo "Stopping Node-Red.."
    echo "Stopping Node-Red.."
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    echo "" >> $LOG
    echo "Node-RED service stop: "$(date) >> $LOG
    pkill -SIGINT node-red
    echo "" >> $LOG
    echo "Node-RED service stop: "$(date) >> $LOG
    ;;

    restart)
  15. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,8 @@ start)
    echo "Starting Node-Red.."
    touch $LOG
    chown $USER:$USER $LOG
    echo -e "\nNode-RED service start: "$(date) >> $LOG
    echo "" >> $LOG
    echo "Node-RED service start: "$(date) >> $LOG
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red >> $LOG &"
  16. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,8 @@ stop)
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    echo -e "\nNode-RED service stop: "$(date) >> $LOG
    echo "" >> $LOG
    echo "Node-RED service stop: "$(date) >> $LOG
    ;;

    restart)
  17. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nodered
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ start)
    echo "Starting Node-Red.."
    touch $LOG
    chown $USER:$USER $LOG
    echo "Node-RED service start: "$(date) >> $LOG
    echo -e "\nNode-RED service start: "$(date) >> $LOG
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red >> $LOG &"
    @@ -42,7 +42,7 @@ stop)
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    echo "Node-RED service stop: "$(date) >> $LOG
    echo -e "\nNode-RED service stop: "$(date) >> $LOG
    ;;

    restart)
  18. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions nodered
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,10 @@ LOG=/var/log/node-red.log
    case "$1" in

    start)
    if ps aux | grep "node-red" | grep -v '/node-red' | grep -v grep > /dev/null
    then
    echo "Node-RED already running."
    else
    echo "Starting Node-Red.."
    touch $LOG
    chown $USER:$USER $LOG
    @@ -30,6 +34,7 @@ start)
    # or
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red >> $LOG &"
    echo "Logging to "$LOG
    fi
    ;;

    stop)
  19. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions nodered
    Original file line number Diff line number Diff line change
    @@ -25,6 +25,7 @@ start)
    echo "Starting Node-Red.."
    touch $LOG
    chown $USER:$USER $LOG
    echo "Node-RED service start: "$(date) >> $LOG
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red >> $LOG &"
    @@ -36,6 +37,7 @@ stop)
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    echo "Node-RED service stop: "$(date) >> $LOG
    ;;

    restart)
  20. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@
    # Short-Description: Node-RED initialisation
    ### END INIT INFO
    # Can be downloaded and installed in one go by using this command
    # sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d node-red defaults
    # sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d nodered defaults

    # This runs as the user called pi - please change as you require
    USER=pi
  21. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodered
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@
    # Short-Description: Node-RED initialisation
    ### END INIT INFO
    # Can be downloaded and installed in one go by using this command
    # sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/node-red && sudo update-rc.d node-red defaults
    # sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/nodered && sudo update-rc.d node-red defaults

    # This runs as the user called pi - please change as you require
    USER=pi
  22. bigmonkeyboy renamed this gist Feb 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-red → nodered
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #! /bin/sh
    # Starts and stops Node-RED
    # /etc/init.d/node-red
    # /etc/init.d/nodered
    ### BEGIN INIT INFO
    # Provides: node-red
    # Required-Start: $syslog
  23. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions node-red
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,6 @@ case "$1" in

    start)
    echo "Starting Node-Red.."
    sleep 2
    touch $LOG
    chown $USER:$USER $LOG
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    @@ -37,13 +36,14 @@ stop)
    # su -l $USER -c "screen -S red -X quit"
    # or
    pkill -SIGINT node-red
    sleep 1
    ;;

    restart)
    echo "Restarting Node-Red.."
    $0 stop
    sleep 2
    $0 start
    echo "Restarted."
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
  24. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions node-red
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,7 @@ case "$1" in

    start)
    echo "Starting Node-Red.."
    sleep 2
    touch $LOG
    chown $USER:$USER $LOG
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
  25. bigmonkeyboy revised this gist Feb 28, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions node-red
    Original file line number Diff line number Diff line change
    @@ -16,16 +16,18 @@
    USER=pi

    # The log is written to here - please make sure your user has write permissions.
    LOG=/tmp/node-red.log
    LOG=/var/log/node-red.log

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

    start)
    echo "Starting Node-Red.."
    touch $LOG
    chown $USER:$USER $LOG
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red > $LOG &"
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red >> $LOG &"
    echo "Logging to "$LOG
    ;;

  26. bigmonkeyboy revised this gist Feb 27, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-red
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ start)
    echo "Starting Node-Red.."
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red -u ~/.node-red > $LOG &"
    su -l $USER -c "node-red-pi --max-old-space-size=128 -u ~/.node-red > $LOG &"
    echo "Logging to "$LOG
    ;;

  27. bigmonkeyboy revised this gist Feb 27, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion node-red
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,8 @@ stop)
    echo "Stopping Node-Red.."
    # su -l $USER -c "screen -S red -X quit"
    # or
    killall node-red
    pkill -SIGINT node-red
    sleep 1
    ;;

    restart)
  28. bigmonkeyboy revised this gist Feb 27, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions node-red
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,7 @@ start)
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red -u ~/.node-red > $LOG &"
    echo "Logging to "$LOG
    ;;

    stop)
  29. bigmonkeyboy revised this gist Feb 27, 2015. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions node-red
    Original file line number Diff line number Diff line change
    @@ -12,17 +12,20 @@
    # Can be downloaded and installed in one go by using this command
    # sudo wget -O /tmp/download https://gist.github.com/bigmonkeyboy/9962293/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/init.d && sudo chmod 755 /etc/init.d/node-red && sudo update-rc.d node-red defaults

    # Note: this runs as the user called pi - please change as you require
    # This runs as the user called pi - please change as you require
    USER=pi

    # The log is written to here - please make sure your user has write permissions.
    LOG=/tmp/node-red.log

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

    start)
    echo "Starting Node-Red.."
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red -u ~/.node-red > /tmp/node-red.log &"
    su -l $USER -c "node-red -u ~/.node-red > $LOG &"
    ;;

    stop)
  30. bigmonkeyboy revised this gist Feb 27, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-red
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ start)
    echo "Starting Node-Red.."
    # su -l $USER -c "cd ~/.node-red && screen -dmS red node-red-pi --max-old-space-size=128"
    # or
    su -l $USER -c "node-red -u ~/.node-red > /var/log/node-red.log &"
    su -l $USER -c "node-red -u ~/.node-red > /tmp/node-red.log &"
    ;;

    stop)