Author |
Message
|
skrv |
Posted: Tue Jun 06, 2017 7:52 am Post subject: need to send an email if number of connections exceeds 200 |
|
|
Centurion
Joined: 26 Oct 2012 Posts: 118
|
am looking to use crontab to send an email whenever the number of connections (usinf netstat command) exceeds let say 200
can anone help me what the excat commands i need to use? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 06, 2017 7:58 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
skrv |
Posted: Tue Jun 06, 2017 9:03 am Post subject: |
|
|
Centurion
Joined: 26 Oct 2012 Posts: 118
|
I know the crontab part of it.
I need help below command which is giving syntax error and i need to write the output to a file
while [ 1 -eq 1 ]; do date; netstat -antp | grep 9901;wc -l sleep 1; done; |
|
Back to top |
|
 |
skrv |
Posted: Tue Jun 06, 2017 9:11 am Post subject: |
|
|
Centurion
Joined: 26 Oct 2012 Posts: 118
|
I have below command which is working, but how can i append the result of the below command to a file?
while [ 1 -eq 1 ]; do date; netstat -antp | grep 9901|wc -l; sleep 5; done; |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 06, 2017 9:19 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
skrv |
Posted: Tue Jun 06, 2017 9:41 am Post subject: |
|
|
Centurion
Joined: 26 Oct 2012 Posts: 118
|
can anyone help me in how to append the result of the below command to a file?
while [ 1 -eq 1 ]; do date; netstat -antp | grep 9901|wc -l; sleep 5; done; |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 06, 2017 9:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
This is not really a place to get answers on basic shell scripting or cron jobs.
You should try someplace like stackoverflow or another forum/place to get help with shell scripts. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
|