Ignore less and tail when checking if we are already running
authorAlan J. Pippin <ajp@pippins.net>
Tue, 27 Dec 2022 19:41:29 +0000 (12:41 -0700)
committerAlan J. Pippin <ajp@pippins.net>
Tue, 27 Dec 2022 19:41:29 +0000 (12:41 -0700)
Change-Id: I09eb76609f3cbd2529b0561cd8611adc3ab9b5fa

zfs-replicate-all

index 01f1becb7a2930c2c9938084951320ba5f4aa1ba..c8a8b03d81140824f1c28ce9dbcfb3f86e77bd0c 100755 (executable)
@@ -19,7 +19,7 @@ tmpfile=`tempfile`
 # Make sure we aren't already running
 SCRIPT_NAME=${0##*/}
 PROCESS_LIST=`tempfile`
-ps -ef | grep -e "$SCRIPT_NAME" | grep -v grep | grep -v $$ | grep -v $PPID >> $PROCESS_LIST
+ps -ef | grep -e "$SCRIPT_NAME" | grep -v grep | grep -v tail | grep -v less | grep -v $$ | grep -v $PPID >> $PROCESS_LIST
 if [[ $? == 0 ]]; then
    echo "$date Another $SCRIPT_NAME process is already running" >> $mylogfile
    cat $PROCESS_LIST >> $mylogfile