The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crontab couldn't run through, help duke0001 UNIX for Advanced & Expert Users 10 02-06-2008 03:22 AM
Using Crontab sumesh.abraham Shell Programming and Scripting 10 02-21-2007 06:19 AM
Crontab gen4ik UNIX for Dummies Questions & Answers 1 01-18-2007 07:26 AM
ftp and crontab user` Shell Programming and Scripting 27 11-13-2006 08:02 PM
Crontab lo-lp-kl UNIX for Dummies Questions & Answers 2 05-05-2005 06:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-22-2007
bob122480 bob122480 is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 9
help with crontab

i have a ksh script that creates messages in a temp directory and then sends them out using the sendmail command and i'm trying to set it up to run every night with crontab.
So the basic gist of the script is
#create temp dir and messages
...
#loop through each message and send using sendmail
ls $dateFolder/Group/* | \
while read tempMsg
do
cat $tempMsg | /usr/lib/sendmail -t
done

When I run the script from the command line in my home directory it works perfectly, but then when I edit my crontab file with something like:
48 23 * * *
/home/users/campbelr/ddts_reminder.ksh /home/users/campbelr/ddts_reminder_config.txt

the temp directory and files are created, but the sendmail command does not execute. I'm an unix shell scripting newbie, so i don't understand how this could happen. is it an environment difference? any ideas?
  #2 (permalink)  
Old 01-22-2007
Andrek Andrek is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 122
Try replaceing the sendmail command with /usr/bin/mailx (toaddress)
you can add a subject if you wish ie
/usr/bin/mailx -s "your subject" me@myhost.com

also you could use ls -1 to force a single line output for your while loop.
  #3 (permalink)  
Old 01-22-2007
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,206
update your script to use the full path to the sendmail binary.
  #4 (permalink)  
Old 01-22-2007
bob122480 bob122480 is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 9
i need to use sendmail and not mailx because all of the header stuff: to, from, subject, etc. are stored in the message, so using the sendmail -t command simplifies things alot.

and

I am using the full path to the sendmail binary
/usr/lib/sendmail
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0