I have a screen task running with node (nodemon)
I would like to restart nodemon at midinght every day
What I do manually is under SSH
- screen -r myscreen
- I TYPE "rs" manually
- I type CTRL+A+D to
detach the screen
Is there a way to automatize that with CRON?
Best Answer
why do you need "screen" in automated tasks ? if you add your task to /etc/crontab (or the personal crontab with "crontab -e" command) and you have the local MTA configured properly to send status mails to your admin, you should be able to achieve that repetitive automatic task including any output+errors without screen at all.
if you need to start scripts or tasks in the background having them run even if the parent shell ends you could look up "nohup" as in "man nohup". if im not wrong it can run your programm/script even when you end your shell/session.