Last active
July 3, 2018 10:17
-
-
Save eib/05c5e5464c34d9b08f06 to your computer and use it in GitHub Desktop.
How to start a node service (lirc-web) around boot-time on a Raspberry pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: sudo crontab -e | |
# Starts "lirc-web" 30 seconds after boot: https://github.com/alexbain/lirc_web | |
@reboot (sleep 30 && /home/pi/scripts/startup/lirc-web.sh) & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# File: /home/pi/scripts/lirc-web.sh | |
PORT=80 /usr/local/bin/node /home/pi/apps/lirc_web/ > /home/pi/apps/lirc_web/out.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# | |
# /etc/rc.local | |
# | |
# This script is executed at the end of each multiuser runlevel. | |
# Make sure that the script will "exit 0" on success or any other | |
# value on error. | |
# | |
# In order to enable or disable this script just change the execution | |
# bits. | |
# Print the IP address | |
_IP=$(hostname -I) || true | |
if [ "$_IP" ]; then | |
printf "My IP address is %s\n" "$_IP" | |
fi | |
# Fix for crontab @reboot not working: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635473 | |
/etc/init.d/cron/start | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Goal: To start a node process at boot time on a Raspberry Pi | |
Solution: | |
* Add a @reboot line to root's crontab | |
* Work-around those jobs not starting (as of Raspbian wheezy, I think) via rc.local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment