Ich habe einen cron-Job mir eine E-Mail zu senden, aber es läuft nicht:Cron Job läuft nicht
#!/bin/bash
TotalMem=$(top -n 1 | grep Mem | awk 'NR==1{print $4}')
UsadoMem=$(top -n 1 | grep Mem | awk 'NR==1{print $8}')
PorcUsado=$(echo "scale=2;($UsadoMem/$TotalMem)*100"|bc)
echo $PorcUsado
UsoCpu=$(top -n 1 | grep Cpu | awk '{print $2}')
echo $UsoCpu
if [ $PorcUsado > 1 ] || [ $UsoCpu > 0 ]; then
echo MEM: $PorcUsado CPU: $UsoCpu|mail -s "Recursos" "[email protected]"
fi
ich konfiguriere in crontab -e
:
* ** * * peter sh /home/peter/scripts/check.sh
Die Skripte über bash normalerweise direkt ausgeführt wird, aber ich erhalte keine E-Mails über cron
ich schätze jede Hilfe
'* * * * *' 'nicht * ** * *'. Dieses Format scheint ungültig zu sein. – tadman
Ich repariere es und laufe noch nicht :( –
Während du ein eigenes Skript ausführst, ist das keine Programmierfrage und wäre besser geeignet für https://unix.stackexchange.com/questions oder https://superuser.com/questions/tagged/linux ... – tink