On Sun, May 14, 2023 at 04:36:03PM +0000, Andy Smith wrote:
> On Sun, May 14, 2023 at 05:04:50PM +0800, Tom Reed wrote:
> > I know convert it to a perl script and run it under App::Daemon for
> > background jobs.
> 
> Having it as a systemd service is a much cleaner solution, whether
> it is shell or Perl or any other language.
> 
> The main point of the App::Daemon module is to detach from shell,
> redirect stdout etc and provide start/stop/status commands, all of
> which are provided by systemd.
> 
> I suppose if aiming for it to be portable to other init systems it
> could still be useful, but even so if on a machine with systemd I'd
> run it as a systemd service and tell App::Daemon to run it
> foreground (so that systemd takes care of backgrounding it).

Or, simply don't use App::Daemon at all.  Just let your program work
in a normal way -- as a single process, with no funky gymnastics.
That's the easiest thing to handle.  It's the correct way.

Reply via email to