aboutsummaryrefslogblamecommitdiffstats
path: root/main/atop/atop-bb-compat.patch
blob: ec46d242667d1b4b6ef80b3f323ddaafecb58b24 (plain) (tree)





























                                                                      
diff --git a/atop.daily b/atop.daily
index e0d994f..8c0cfc0 100755
--- a/atop.daily
+++ b/atop.daily
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 CURDAY=`date +%Y%m%d`
 LOGPATH=/var/log/atop
 BINPATH=/usr/bin
@@ -7,11 +7,15 @@ INTERVAL=600		# interval 10 minutes
 
 # verify if atop still runs for daily logging
 #
-if [ -e $PIDFILE ] && ps -p `cat $PIDFILE` | grep 'atop$' > /dev/null
-then
-	kill -USR1 `cat $PIDFILE`	# take final sample
+pid=
+if [ -e $PIDFILE ]; then
+	pid=$(cat $PIDFILE)
+fi
+
+if [ -n "$pid" ] && [ -d /proc/$pid ]; then
+	kill -USR1 $pid	# take final sample
 	sleep 3
-	kill -TERM `cat $PIDFILE`
+	kill -TERM $pid
 	rm $PIDFILE
 	sleep 1
 fi