Recently Written · git

xinput-persistence

xinput for mouse or keyboard configurations that work when disconnected or on boot.

git clone https://github.com/equwal/xinput-persistence

Log | Files | Refs


commit f6387778128fd896be943ec42c7aaa805d038df5
Spenser Truex <spensertruexonline@gmail.com>
2019-04-27 22:19:44 -0700

Error checking for already running monitor.

 forking.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/forking.pl b/forking.pl
index 8d3ad1a..55d80d0 100755
--- a/forking.pl
+++ b/forking.pl
@@ -1,8 +1,12 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-my $ps = `ps -e | grep monitor\\.pl`;
+my $ps = `ps -eo pid,cmd | grep monitor\\.pl`;
 if(!($ps eq '')) {
+    $ps =~ /(^[0-9]+)/;
+    my $pid = $1;
+    print "Monitor already running at pid $pid. Try \$ ps -eo pid,cmd | grep $pid\n";
+} else {
     my $pwd = $ARGV[0];
     open my $com, '<', "$pwd/commands.conf";
     for(<$com>) {
@@ -13,6 +17,5 @@ if(!($ps eq '')) {
             `$_`;
         }
     }
-
     while(1){;}
 }