Forum Discussion

Thuchapon_92030's avatar
Thuchapon_92030
Icon for Nimbostratus rankNimbostratus
Jun 16, 2011

Crontab issue

Now I found some problem about crontab, it don't send email for my expect.

 

 

******************************************

 

my crontab code is;

 

 

*/2 * * * * /etc/.../name.sh ;I want to run this script every 2 minutes but it don't send anything.

 

 

but when I run this script manually, it work.

 

 

*******************************************

 

My script is:

 

 

 

 

!/bin/bash

 

(printf "%s\n" "Subject: subject" "To: mail@mail.com" "Content-Type: application/ucs" \

 

"Content-Disposition: attachment; filename=$(date +%Y%m%d)hostname.ucs" \

 

"Content-Transfer-Encoding: base64" ""; base64 /var/ucs/hostname.ucs) | sendmail mail@mail.com

 

 

*******************************************

 

 

 

please help me

 

 

 

 

 

 

  • have u tried using full path to sendmail? it works for me.

     

     

    !/bin/bash

     

    (printf "%s\n" "Subject: subject" "To: mail@mail.com" "Content-Type: application/ucs" \

     

    "Content-Disposition: attachment; filename=$(date +%Y%m%d)hostname.ucs" \

     

    "Content-Transfer-Encoding: base64" ""; base64 /var/ucs/hostname.ucs) | /usr/sbin/sendmail mail@mail.com

     

     

    in addition, u know the default ucs directory is /var/local/ucs. u intend to use /var/ucs, don't u?

     

     

    cheer!