After logging in to a remote server. I use nohup
command to run a scheduler job
which runs using the node-schedule
module. So basically a nodejs file contains the code for scheduling the job which has to run every 12 hours. I logout and then login but it stops sometimes. Can anyone suggest what might be happening ?
Why is it getting stopped ? I want to debug, but then I have no clue as to, why is it stopping ?
Asked
Active
Viewed 209 times
0

abkds
- 1,764
- 7
- 27
- 43
-
Did you check the content of the file `nohup.out`? Did you check if the scheduler is still running (`ps ax | grep
`)? – cdauth Dec 29 '15 at 06:32 -
yes when I do `ps -ef | grep node` , it doesn't show the process – abkds Dec 29 '15 at 06:33
-
The `nohup` command creates a file `nohup.out` in the directory where you execute it. All the output from the program is redirected into that file. So if node crashed due to an exception, the exception should be logged in the file. – cdauth Dec 29 '15 at 06:39
-
yeah , I checked that out the nohup.out is empty, because it should have ran next at 12:00. – abkds Dec 29 '15 at 06:40
-
And there are no exceptions from node – abkds Dec 29 '15 at 06:41
-
If your script really works when running it without `nohup`, then I have no further clue what could be wrong. One workaround might be to use cron instead for scheduling, the other might be to use one of the solutions [here](http://stackoverflow.com/questions/4018154/node-js-as-a-background-service). – cdauth Dec 29 '15 at 07:23
-
have you explored using forever ? – Rahul Dec 29 '15 at 07:55
-
Yeah I am checking for other solutions. – abkds Dec 29 '15 at 08:48