Find the answer to your Linux question:
Results 1 to 2 of 2
Hi All, Can anyone help with this? Basically, we want to run a command in the cron that checks the amount of domains on a server, and sends a warning ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    1

    Script Help Rqd - Warning mail when wc -l /etc/localdomains is more than 100?

    Hi All,

    Can anyone help with this? Basically, we want to run a command in the cron that checks the amount of domains on a server, and sends a warning mail to an Email address if that number is, say, above 100.

    We can get the number of domains with:

    wc -l /etc/localdomains

    ...but how to check if its more than 100 and only then send a warning mail?

    Thank you for any help!

  2. #2
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    hi,


    have you tried something like this
    Code:
    #!/bin/bash
    
    LDOM=`wc -l /etc/localdomains | awk '{print $1}'`
    
    if [ $LDOM -gt 100 ]
    then
    # here you use mail for example to send the mail
    fi
    Linux and me it's a love story

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...