Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub check_duplicate
- {
- (my $cmdline = qx(cat /proc/$$/cmdline)) =~ s/(?:\0(?!$))\0?/ /go;
- open my $fh, "-|", "pgrep", "-x", "-f", $cmdline or die;
- do { print "duplicate instance\n" if -t STDIN; exit } if scalar @{[<$fh>]} >= 2;
- close $fh;
- }
- &check_duplicate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement