Issue
For an app i want an url to be visited every one second. to make this happen on my Google Cloud ubuntu server i run this command
nohup watch -n 1 curl https://www.website.com/phpfile.php &
after that i log out. This works fine for some time but after a while (not sure how long but i think some hours) it stops.
when i log back in to the server and i do a
sudo ps -aux
i still see the command but it doesn't seem run the .php file anymore(i conclude this by going to the url by hand and seeing that it didnt process). when looking at the performance of the server i don't see a problem there.
Am i doing something wrong, or is there maybe a better way to visit a url every one second without stopping?
Solution
Do not use nohup to run background commands with SSH. nohup is designed for terminal sessions (terminals are the ancient CRTs that were connected using RS232).
Use screen, tmux, or similar programs that support detaching from and reattaching to a process. This will allow you to start a program, detach and the disconnect from SSH. Later you can reconnect with SSH, and then reattach to the program or programs.
Answered By - John Hanley Answer Checked By - Gilberto Lyons (WPSolving Admin)