The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Software Raid one cron job

Discussion in 'General Discussion' started by parag joshi, May 4, 2009.

  1. parag joshi

    parag joshi Well-Known Member

    Joined:
    Sep 2, 2008
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    How to create cron job software raid one and email should come to us?

    Please advise.
     
  2. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    What??

    You want to create a cron job, it emails the results of the status of a raid array? Or ??


    Code:
    #!/bin/sh
    
    # Email mdadm status
    
    for i in '/dev/md0 /dev/md1 /dev/md2 /dev/md3'
    do
    /sbin/mdadm --detail $i > /customscripts/raid-report.txt
    done
    
    mail -s "raid report" user@domain.com < /customscripts/raid-report.txt
    
    This script takes a space-separated list of md (raid) devices, runs a report, plunks in a txt file and then emails it.


    (I tried to make it cleaner by setting the list to 'md0 md1 md2 md3' and the using /sbin/mdadm --detail /dev/$i but it only processes the first element, and errors out on the rest... unsure why)
     
    #2 Lyttek, May 5, 2009
    Last edited: May 5, 2009
Loading...

Share This Page