I am currently trying to setup a little autostart for several node applications on my raspberry pi 3 (running raspbian). I use crontab to run the following commands @reboot
// These @reboot commands work fine
@reboot screen -S deployment -d -m nodemon ~/share/infrastructure/deployment/server.js
@reboot screen -S hue -d -m nodemon ~/share/smart-home/backend/hue/server.js
@reboot screen -S sonos -d -m nodemon ~/share/smart-home/backend/node-sonos-http-api/server.js
@reboot screen -S lametric -d -m nodemon ~/share/smart-home/backend/lametric/server.js
// This concatenation of commands doesn't behave as expected
@reboot screen -m -d -S frontend;
screen -r -S frontend -X stuff 'cd ~/share/smart-home/frontend/'`echo -ne '\015'`;
screen -r -S frontend -X stuff 'npm run dev'`echo -ne '\015'`;
The problem is, the last command launches a screen session that behaves like a running application without really starting my node.js server. It look like this.
For clarification. In the relevant command i'm trying to launch a screen instance with named "frontend". Then i want to navigate to "~/share/smart-home/frontend/" inside this screen instance. As the last step i'm starting the corresponding node server with "npm run dev".
via user3652991
No comments:
Post a Comment