cron/sendmail problem - Help

This is a discussion on cron/sendmail problem - Help ; I was hoping someone could help me out here. Here is the relevant info: My crontab: root@KnoppixServer:~# crontab -l 54 5 1,7,14,21,28,30 * * /root/cronjobs The file it is calling: root@KnoppixServer:~# cat /root/cronjobs echo Server Status Update > statusMail echo ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: cron/sendmail problem

  1. cron/sendmail problem

    I was hoping someone could help me out here. Here is the relevant
    info:

    My crontab:
    root@KnoppixServer:~# crontab -l
    54 5 1,7,14,21,28,30 * * /root/cronjobs

    The file it is calling:
    root@KnoppixServer:~# cat /root/cronjobs
    echo Server Status Update > statusMail
    echo >> statusMail
    date >> statusMail
    echo >> statusMail
    du -ch --max-depth=2 /mnt/storage/ | egrep -i
    '([0-9]{3,}(\.[0-9]+)?M|[0-9]+(\.[0-9]+)?G)' >> statusMail
    echo >> statusMail
    free -m >> statusMail
    echo >> statusMail
    df -h >> statusMail
    echo >> statusMail
    uptime >> statusMail
    cat statusMail | sendmail myrealaddress@somewhere.zzz





    Now, if I run the script manually by typing /root/cronjobs, it works.
    the file statusMail is created, and filled up with all the cool info.
    Then, cat pipes the text to an e-mail, which I receive successfully.

    But, if the cron job runs, I get no e-mail. The file IS created,
    which I've verified by the timestamp of the statusMail file.

    By the way, that long line (which may have wrapped here in the
    newsgroup),
    is a regular expression which causes only lines of over 100mb from the
    output of
    "df -h" to display. Nice for finding bloat on a fileserver.

    Thanks in advance,
    Shawn

  2. Re: cron/sendmail problem

    It's me again. I solved the problem by using the command "mail",
    instead of "sendmail". It works fine with "cat". I still don't know
    why sendmail doesn't work, but it doesn't work with either sendmail or
    postfix (which has a "sendmail" clone included).

    Also, there's a typo in my post regarding that regular expression, I
    should have typed "du" instead of "df", but I'm sure you got the
    point.

    Shawn

  3. Re: cron/sendmail problem

    Quote Originally Posted by unix View Post
    It's me again. I solved the problem by using the command "mail",
    instead of "sendmail". It works fine with "cat". I still don't know
    why sendmail doesn't work, but it doesn't work with either sendmail or
    postfix (which has a "sendmail" clone included).

    Also, there's a typo in my post regarding that regular expression, I
    should have typed "du" instead of "df", but I'm sure you got the
    point.

    Shawn
    instead of mail or sendmail ... use /usr/sbin/sendmail

    Thanks

+ Reply to Thread