0

I have a php file runned throug nohup that allows sockets with php library called ratchet:

nohup php /var/www/html/bin/server.php > /dev/null 2> /dev/null & echo $!

But sometimes the file crashes because of "mysql server has gone away" or other undiscovered problems.

What solutions can I use to be sure that the running file is working at 100%?

2
  • You could run it under the control of Systemd and arrange for it to be restarted automatically if it fails.
    – larsks
    Sep 7, 2022 at 11:29
  • How will you EVER know there was a problem when your are sending all output to /dev/null? Sep 9, 2022 at 14:22

1 Answer 1

0

As @larsks already commented: from the perspective of a sysadmin you run your process from a suitable supervisor such as systemd or one of the others listed on https://en.wikipedia.org/wiki/Process_supervision

That should take care of the process getting started at system boot, restarting it at failures, stopping the service when requested and some logging.

Second: an external monitor that checks if the system where your software runs and the software itself still works as intended, is healthy, has sufficient resources etc. and alerts you when it isn’t.

As a sysadmin I typically can’t do anymore than that. When your custom application is crap then that is what needs fixing (and redirecting errors to /dev/null is not helpful for detecting errors )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .