svann wrote:
hello does anyone have any ideea how can i make a script to runn this command netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr and to email me the results of the command ?
If you have mailx installed ...
Code:
!/bin/bash
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | mailx -s 'SUBJECT GOES HERE' -r 'REPLYTO@EMAIL.com' 'SENDTO@EMAIL.com'
exit 0
Or ......... instead of a script , that line could just be put in it's entirety into crontab, as a one line cronjob.
HTH's