Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: perl scripting help

by navalned (Sexton)
on Jun 02, 2021 at 01:56 UTC ( #11133393=note: print w/replies, xml ) Need Help??

in reply to perl scripting help

Taking it a little further and daemonizing, etc...

#!/usr/bin/env perl use common::sense; use POSIX qw//; defined (my $pid = fork()) or die "Can't fork: $!"; exit if $pid; chdir "$ENV{HOME}" or die "Can't chdir $ENV{HOME}"; POSIX::setsid or die "setsid: $!"; close STDOUT; close STDIN; close STDERR; open STDIN, '<', "/dev/null" or die "open: $!"; open STDOUT, '>', "/dev/null" or die "open: $!"; open STDERR, '>', "/dev/null" or die "open: $!"; defined ($pid = fork()) or die "Can't fork: $!"; if ($pid) { waitpid $pid, 0; } else { eval { my @cmd = ( '/usr/X11R6/bin/xterm', '-e', '/bin/sh -c "find . | xargs egrep "perl""', #simulate module loading ); exec @cmd; }; warn $@ if $@; exit 1; }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133393]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-01-19 08:53 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.