![]() If your program needs to perform any cleanup, write a signal handler. There's a standard mechanism to tell a process to exit: signals. This approach has many advantages over having the program do the restart by itself: it's standard, so you can restart a bunch of services without having to care how they're made it works even if the program dies due to a bug. There are also fancier monitoring programs but you don't sound like you need them. Configure init to launch your program at boot time or upon explicit request, and to restart it if it dies. ![]() There are many different init programs (SysVinit, BusyBox, Systemd, etc.), with completely different configuration mechanisms (always writing a configuration file, but the location and the syntax of the file differs), so look up the documentation of the one you're using. The init program offers such a monitoring system. The normal way to do this is to let your program exit, and use a monitoring system to restart it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |