I don't think you want to use Daemon::Control. How about a nice, simple fork()?
On Mon, Mar 9, 2020 at 8:46 PM Matthew Pressly <matthew.pres...@gmail.com> wrote: > From a mojolicious web app, I need to be able to launch gvim by clicking a > link or button to edit a particular file. > > Currently, I have this in the app: > > get '/edit' => sub { > my $c = shift; > my $result = `/usr/bin/gvim $filename 2>&1`; > $c->redirect_to('/'); > }; > > Sometimes it works, but other times, gvim runs twice when the link is > clicked and more frequently, gvim runs but hangs up in the background, > after which I end up killing the gvim process and killing and restarting > the web app to get it back to working. > > Is there a way to launch gvim (or other interactive programs) more > reliably? > > I'm using the following for a start script: > > #!/usr/bin/perl > use warnings; > use strict; > use Daemon::Control; > > exit Daemon::Control->new( > name => "My Application", > lsb_start => '$syslog $remote_fs', > lsb_stop => '$syslog', > lsb_sdesc => 'My App', > lsb_desc => 'Controls the time tracker service.', > #path => '/home/symkat/etc/init.d/program', > > program => '/usr/bin/morbo', > program_args => [ '/path/to/mojolicious/app.pl' ], > > pid_file => '/tmp/myapp.pid', > stderr_file => '/var/log/myapp/myapp.log', > stdout_file => '/var/log/myapp/myapp.log', > > user => 'myuser', > group => 'myuser', > > fork => 2, > > )->run; > > > Thank you, > > -- > Matthew > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mojolicious+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mojolicious/8930b24b-4e37-4b56-82ed-fad82031fe44%40googlegroups.com > <https://groups.google.com/d/msgid/mojolicious/8930b24b-4e37-4b56-82ed-fad82031fe44%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/CAG2_C8CwMLwBXwVDdEicwpMYX1fvc3MHSo_CML_4Q7i%3DEHhwgg%40mail.gmail.com.