Cronjob - Redirect mail output to file, LINES & COLUMNS


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cronjob - Redirect mail output to file, LINES & COLUMNS
# 1  
Old 04-14-2008
Cronjob - Redirect mail output to file, LINES & COLUMNS

I currently have an expect script that issues the 'mail' command and sends an 'x' when it receives the & prompt from mail to quit.

The expect script is able to do
Code:
stty rows 100 columns 200 < $spawn_out(slave,name)

to set up the number of columns and rows.

I would like to get rid of the expect script and replace it with a simple shell script to do something like:
Code:
mail < x.txt > mailList.txt

Where x.txt simply has an x in it that will end mail when it looks for input.

However, the list of mail messages is truncated because of the number of rows and columns or LINES and COLUMNS.

I've tried doing
Code:
stty rows 100 columns 200

before issuing the mail command in the console but it appeared to have no effect. I also tried in the bash script but that printed an error as expected since stty can't be issued in scripts from a cronjob (no term). I've also tried exporting LINES and COLUMNS environment variables but it did not help.

I'm sure there is an easy work around but I can't figure this out.

Any advice would be greatly appreciated.

Thank you,
-Jesse
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cronjob output to file AND to email (as attachment)

I have a shell script that runs on our webserver logs, and grabs various useful data and then outputs this data to a .csv file. What I want to do now is schedule a cronjob to run this script for me each week at a designated time, AND email the .csv file that is created as an attachment to... (1 Reply)
Discussion started by: xdawg
1 Replies

2. Shell Programming and Scripting

Need Script to ZIP/SAVE & then DELETE Log file & send a mail conformation for any error

ENVIROMENT Linux: RHEL 6.4 Log Path: /usr/iplanet/servers/https-company/logs Log Format: user.log.03-15-2015 I have log4j log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I need a script that will run daily that... (1 Reply)
Discussion started by: admin_job_admin
1 Replies

3. Shell Programming and Scripting

E-mail Output Merge Lines for Some Text..

Hi all. This is the content of the text file used for the e-mail: TM ICP-EDW BILLING REGISTER USAGE BREAKDOWN_01062014.csv TM_ICP_EDWH_FICL_13062014.TXT TM_ICP_EDWH_FICL_16062014.TXT TM_ICP_EDW_Detailed Payment Journal Report_13062014.txt TM_ICP_EDW_Detailed Payment Journal... (9 Replies)
Discussion started by: aimy
9 Replies

4. UNIX for Dummies Questions & Answers

Converting txt output to rows and columns and send report via mail.

Hi All, I would like to send below output in a tabular column ( xml or excel ) and send a mail. vinay unix anil sql vamsee java request to suggest a solution. (1 Reply)
Discussion started by: Girish19
1 Replies

5. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

6. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

7. Shell Programming and Scripting

incrementing lines in the file & format output.

Hi All, I need read the file and out put format as below using ksh, I wrote below script its keep on repeating first line in the file. may i know the best way to get the below out put while incrementing line in the file. cat b.txt |awk '{print $0}' |while read line do aa=`cat $line |head -1... (7 Replies)
Discussion started by: ashanabey
7 Replies

8. UNIX for Dummies Questions & Answers

Search for & edit rows & columns in data file and pipe

Dear unix gurus, I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this: adam peter blah blah blah blah blah blah car 01 30 200 02 31 400 03 57 121 .. .. .. .. .. .. n y... (8 Replies)
Discussion started by: tintin72
8 Replies

9. Shell Programming and Scripting

Remove lines, Sorted with Time based columns using AWK & SORT

Hi having a file as follows MediaErr.log 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:12:16 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:22:47 84 Server1 Policy1 Schedule1 master1 05/08/2008 03:41:26 84 Server1 Policy1 ... (1 Reply)
Discussion started by: karthikn7974
1 Replies

10. Shell Programming and Scripting

redirect only the standard error output to mail

I'm writing a script using file descriptor 2 (std error) to send an email only if the command fails or errors out but the script always emails me irrepective of whether it fails or not. It will not email the /tmp/check.error file output if doesn't error out just the mail with the subject "Cannot... (3 Replies)
Discussion started by: barkath
3 Replies
Login or Register to Ask a Question