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?

  • 2
    screen is not a replacement to properly configure your services as such, please don't abuse it like that. – Sven Jul 10 '15 at 10:19

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.

| improve this answer | |
  • my nodemon runs in screen: it is the best solution I have found to supervize many of my node process. So I need to keep it running in screen. – yarek Jul 10 '15 at 12:26
  • i dont know "node" nor "nodemon". but im starting to think this is kind of an "interactive User interface" or some sort. am i right ? – Axel Werner Jul 10 '15 at 13:04
  • In this case im out. i would try to look for a way to controll the app from the "outside", the command line interface. a lot of apps can accept command line options which may enable you to send commands or "messages" to within the app. maybe check out "man nodemon" or whatever you use to controll your nodes. good luck – Axel Werner Jul 10 '15 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.