0

I'm running a node app via a shell script

#STARTUP.sh
node server.js

#/etc/rc.local  - this runs on startup of my machine
sudo sh startup.sh >> /home/pi/logs/app.log 2>&1

My issue is, when I have an error in my node app it just crashes and doesn't write the error to app.log

Is there a way to make sure when the app crashes that the error gets logged as well?

Justin Young
  • 2,393
  • 3
  • 36
  • 62

1 Answers1

1

Replace the last line with this:

sudo sh startup.sh &>>/home/pi/logs/app.log
Coder-256
  • 5,212
  • 2
  • 23
  • 51