21-09-2022, 08:41
0
Kod:
#!/bin/bash
tmp=`mktemp`
ps ax -o uname,pid,etimes,command | grep -v root | while read -r username pid time com ;
do
if [[ $time -gt 3600 ]];
then
echo Proces $username $pid $com -wykonuje sie: $time sekund to jest `date "+%j dni %H godzin %M minut %S sekund" -d @$time` >> $tmp
fi
done
if [[ -s $tmp ]]; then
cat $tmp
rm $tmp
exit 2
else
echo OK
rm $tmp
exit 0
fi