Seems Complicated but would b happy if its possible


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Seems Complicated but would b happy if its possible
# 1  
Old 05-28-2008
Hammer & Screwdriver Seems Complicated but would b happy if its possible

Hey guys, I m here again with (may b) a silly query n sorry for that, I am new to UNIX n all so don't kno much @ it.
Thro' a script I am generating an output (It is a TXT file) After generating it, I get it to windows n mails it by dragging n dropping it in lotus mail new mail window.
Is there any way out by which I can automate this process?
# 2  
Old 05-28-2008
Use the mailx command in unix to send the mails..

Code:
man mailx

If you are scripting in perl, this might help you..

Code:
sub _send_email($$$) {
	my $recipient = shift;
	my $full_name = shift;
	my $result_file = shift;
	my $res_file = basename($result_file);
	my $res_dir = dirname($result_file);
	chomp(my $hostname = qx/uname -n/);

	my $msg = MIME::Lite->new(
		From => '"Manager Issuance" <abc@@xyz.com>',
		To => "\"$full_name\" <$recipient>",
		Subject => "Results of deck_check.upl for $input_dir on $hostname",
		Type => 'multipart/mixed',
		Data => "The results of your deck_check.upl run are attached."
	);

	$msg->attach(
		Type => 'TEXT',
		Data => "Hello,\n$full_name\n\nPlease DO NOT reply to this email!\n\nIt was generated by a non-user account.  Attached is a file\ncontaining the results of your requested run.\n\nThank You,\n
	);

	$msg->attach(
		Type => 'TEXT',
		Path => "$result_file",
		Filename => "$res_file",
		Disposition => 'attachment'
	);

	$msg->send("sendmail");
}

# 3  
Old 05-28-2008
Hey Thak you very much for the reply but can u explain it to me.. plz... take an example of my out put file.. suppose its name is "123456.txt" n o/p is going to get generated on path /temp/anushree/output/123456.txt n i want to send the email as it gets generated.
Plz help... Is it possible?
# 4  
Old 05-28-2008
Through which script the file is being generated, you need to add following line to script.

mail -s "Log file attached" <email Id> < <Logfile name>

I think it will solve your problem.

Thanks & Regards,
Siba
# 5  
Old 05-28-2008
Hey Siba, thanx for the reply
In <log file> should i type o/p file which is to be mailed?
# 6  
Old 05-28-2008
Quote:
Originally Posted by anushree.a
Hey Siba, thanx for the reply
In <log file> should i type o/p file which is to be mailed?
No, not in Log file. How the log file is created? I think it is being created when one file is executed and in that file the it is also mentioned where where it will create the log file.

You need to add above things to the file which is responsible to create the log file.

Regards,
Siba
# 7  
Old 05-28-2008
Siba, the "mail" tool doesn't accept attachment like this, at least not on Debain Linux nor on AIX (at least not that I know of).

Easiest is maybe:

Code:
(echo "some mail body text blablabla" | uuencode somefile.dat somefile.dat) | mail -s "some subject" jupp@juppes.org

For uuencode you can use the same infile's name for the one being encoded, up to you ^^
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Complicated string

I have a data file example 10302|77747373|442422442|290209|244242|"234|2352"|92482892 It has about 5000 rows the same way in that field. Needs to look like this.... I need to remove the quotes but the more difficult thing is to remove the pipe between the quotes because there is a pipe... (6 Replies)
Discussion started by: xgringo
6 Replies

2. Solaris

Solaris? Is it really this complicated?

Hello Everybody, I am a mid-level Linux administrator trying to get a hold of Solaris. So far, my experience has been painful. I think it's confusing and it's just a big mess... To be more specific, I have noticed that whenever I install a package... it never followed a specific pattern.... (4 Replies)
Discussion started by: EssenceNY
4 Replies

3. Shell Programming and Scripting

complicated alias command

hi guys i m making one alias which will set variable , invoke sqlplus and also set prompt of sqlplus,,i have made successfully upto invoking sqlplus in unix but cant pass command in sqlplus here is the command alias sett='export ORACLE_SID=devdb2;sqlplus system/system@test' now this... (3 Replies)
Discussion started by: tapia
3 Replies

4. Shell Programming and Scripting

Complicated job distribution

Hello, This is going to sound convoluted, however, this is how I need to do things. I have three awesome machines and a couple hundred jobs. EACH of these jobs takes approximately 4 hours to complete. I want to give jobs to each of these machines, and their respective CPUs in an intelligent... (1 Reply)
Discussion started by: amcrisan
1 Replies

5. Linux

Complicated Join command!

Hi I have a serious issue when trying to join to files so I have two files, one for meals and one for people Meal1:Turkey:Potato Chips:Twinkie:Coke:5.95 Meal2:Ham & Cheese:Doritos:Cookie:Sprite:6.49 Meal3:Vegetarian:Cheese Crackers:Brownie:Pepsi:5.75 Meal4:Tuna:Cheese Puffs:Eclair:Diet... (1 Reply)
Discussion started by: ehshi1992
1 Replies

6. Shell Programming and Scripting

complicated search within file

Hi, I have following problem. I have a file with time stamps and some data describing what happened between time stamps. Something like this: 10:00 meeting with K meeting with L 11:00 lunch 12:00 work with K 13:00 From this file I have to get a file with... (7 Replies)
Discussion started by: mmike
7 Replies

7. Shell Programming and Scripting

Sort complicated two fields

Hi experts, I am trying sort command with my data but still not getting the expected results. For example, I have 5 fields data here c,18:12:45,c,c,c d,12:34:34,d,d,d a,13:50:10,a,a,a b,13:50:50,b,b,b a,13:50:50,a,a,a b,14:10:01,b,b,b c,10:12:45,c,c,c I want to get ... (3 Replies)
Discussion started by: lalelle
3 Replies

8. UNIX for Dummies Questions & Answers

complicated(?) grep

Hi all, I need help to figure out this grep. I would like to search all files in a directory for the occurrence of abc AND xyz. I started with this: grep -i abc * | grep xyz But this only returns lines which contain both values on the same line. So I am thinking that I need to do... (5 Replies)
Discussion started by: khearnen
5 Replies

9. Shell Programming and Scripting

More complicated log parsing

Hey Guys, I am trying to grep within a file to find and output certain parts of lines to other file(s). The output files need to have a dynamic file name based on a field in the main log. The problem is that every line of the log is not the same, and often not even similar. To explain... (25 Replies)
Discussion started by: sjug
25 Replies

10. Shell Programming and Scripting

Very complicated script..

I have a script that I need to create tha involves moving files and renaming them(see previous post) Are there any websites with user made shell scripts? (5 Replies)
Discussion started by: rocinante
5 Replies
Login or Register to Ask a Question