- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script to mail data file not including data
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 06:28 AM
04-11-2005 06:28 AM
shell script to mail data file not including data
dest=username@email address
if [ -f /home/robinson/myfile* ]
then
cd /home/robinson
for file in `ls myfile*`
do
/usr/contrib/bin/gzip -c $file > ${file}.gz
echo "[include ${file}.gz application/octet-stream base64]" > ${file}.gz.uu
elm -s "Subject - $file" $dest < ${file}.gz.uu
rm -f ${file}.gz
rm -f ${file}.gz.uu
exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 06:32 AM
04-11-2005 06:32 AM
Re: shell script to mail data file not including data
Do you have that file?? and more than zero bytes??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 06:34 AM
04-11-2005 06:34 AM
Re: shell script to mail data file not including data
the "for" loop. The syntax for "for" loop is:
for file in ....
do
....
done
You don't get any syntax error because of "exit".
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 06:34 AM
04-11-2005 06:34 AM
Re: shell script to mail data file not including data
The best way to send files is with uuencode:
for i in `echo filename1 filename2 filename3 ...` do uuencode $i $i.txt
done|mailx -m -s "test" username@whereever.com
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 06:35 AM
04-11-2005 06:35 AM
Re: shell script to mail data file not including data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 06:47 AM
04-11-2005 06:47 AM
Re: shell script to mail data file not including data
#dest=username@emailaddress
if [ -f /home/robinson/file* ]
then
cd /home/robinson
for file in `ls file*`
do
/usr/contrib/bin/gzip -c $file > ${file}.gz
echo "[include ${file}.gz application/octet-stream base64]" > ${file}.gz.uu
elm -s "Subject - $file" $dest < ${file}.gz.uu
rm -f ${file}.gz
rm -f ${file}.gz.uu
mv /home/robinson/file1 /bkup
exit
done
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 07:25 AM
04-11-2005 07:25 AM
Re: shell script to mail data file not including data
try running your script like this:
# sh -x
Btw: do not use "for file" as "file" is also a command.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 07:37 AM
04-11-2005 07:37 AM
Re: shell script to mail data file not including data
cd /home/robinson
for file in `ls file*`
do
if [ -s $file ]
then
/usr/contrib/bin/gzip -c $file > ${file}.gz
echo "[include ${file}.gz application/octet-stream base64]" > ${file}.gz.uu
elm -s "Subject - $file" $dest < ${file}.gz.uu
sleep 3
rm -f ${file}.gz
rm -f ${file}.gz.uu
mv /home/robinson/file1 /bkup
exit
fi
done
The "sleep 3" should take care of Clay
Stephenson's suggestion that it might be timing
issue. You could remove it later if that turns out
to be a non-issue.
I'm not sure [ -f /home/robinson/file* ] is a good
idea as -f expects a single file name.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2005 08:55 AM
04-11-2005 08:55 AM
Re: shell script to mail data file not including data
I think the included file is being unlinked before elm can read it. Remember, the include is a directive to read an external file. It's possible that elm has simply queued the mail job at this point but not processed the include statement.
Consider this ananlogous situation:
lp -dmyprinter myfile
rm myfile
It's possible that myfile will never be printed because though the printjob has been scheduled; it hasnt actually starter reading the file. On the other hand:
lp -dmyprinter -c myfile
OR
cat myfile | lp -dmyprinter
rm myfile
will work everytime because the file is either copied or is piped to the lp command before it can be used.
Again, I can't tell from your blank email but it would be a good idea to incluse some text before and after your [include] clause so that it would be very obvious what is happening.