Sponsored Content
Full Discussion: Log and Mail problem
Top Forums UNIX for Dummies Questions & Answers Log and Mail problem Post 302172287 by chris1234 on Monday 3rd of March 2008 09:08:52 AM
Old 03-03-2008
Log and Mail problem

Hey Guys,

I am trying to do a recursive search in one directory. If the directory contains that specific folder then create a directory in my other remote machine and use SCP to transfer all the contents of the file.

Till this stage everything works fine. So now i need to add 2 more functionality.

1) If scp fails then mail it to appropriate person and store it in a log file.
2) If scp pass then store a message in the log file stating that SCP has been successful.

For some reason everytime i run my script it gives me an error.

Code:
./file_transfer1.sh[38]: 0403-057 Syntax error at line 45 : `<' is not matched.

And here is my code:

Code:
 LOCAL_LOG_FILE="priceops_`date +%m%d%Y`.log"

     cd /home/abc/nissan
     for dir in *; do
     if [ -d ${dir}/priceops ]; then
     /usr/local/bin/ssh -l ferrari xyz "mkdir -p  /az/web/test/$dir"
     scp -r ${dir}/priceops ferrari:/az/web/test/${dir}/
      echo "File Transferred failed from SUPRA to FERRARI `date +%n%m/%d/%Y%n%H:%M:%S`" >>$LOCAL_LOG_FILE 2>&1
     fi
    done

    if [ $? != 0 ]; then

    echo "Error occured"
    mailx -s "File Transfer Failed" "abc@xyz.com" <<-EOT
    scp failed from SUPRA to FERRARI
   `date`
    EOT
    echo "File Transferred failed from SUPRA to FERRARI `date +%n%m/%d/%Y%n%H:%M:%S`" >>$LOCAL_LOG_FILE 2>&1

The script is not even creating a log file also.
Thank you.,

Last edited by chris1234; 03-03-2008 at 10:15 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem with mail

what I have to write in a shell that every time that it arrives a new e-mail has to perform a program taking some data from the e-mail. (2 Replies)
Discussion started by: mmistero
2 Replies

2. UNIX for Dummies Questions & Answers

E-mail problem

Is it true that you need port 110(POP3) to be open for sending email out ?? I can send email out fine but when I check my port 110 is not open. The problem I have is that I can not receive email at all or can not send email locally (between my users). Here is what I get using the netstat... (6 Replies)
Discussion started by: guest100
6 Replies

3. UNIX for Advanced & Expert Users

mail problem !!

Hi, Below a try to send an email to a local user can be seen. I can NOT send e-mail anywhere, but I receive email perfectly. <pre> isgsi01(root)10: mail aris < /home/aris/mail2send dbm map "Alias0": unsafe map file /etc/mail/aliases: No such file or directory </pre> ..... but the... (3 Replies)
Discussion started by: guest100
3 Replies

4. UNIX for Dummies Questions & Answers

mail problem (NOT Mail or Mail.app)

When I try to use the CLI mail, I get the following error. What's wrong? Welcome to Darwin! % mail root Subject: test test . EOT % /etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory Do I just need to change the... (1 Reply)
Discussion started by: chenly
1 Replies

5. UNIX for Dummies Questions & Answers

Problem with mail

Hello! I have to servers with Solaris 2.7. I mail from first to second ( mailx user@dev < letter ). But mail not arrive to second. It return by daemon with explanation: .... --- Transcript of session follows --- 550 5.1.2 user@dev... Host unknown (Name server: mailhost.serv.dom: host not... (2 Replies)
Discussion started by: Colf
2 Replies

6. UNIX for Dummies Questions & Answers

Problem with mail.

Hello! I have two servers with Solaris 2.7 I send mail from first to second. The first is also dns. It's known as "ns.oldb.pkb", second is "dev.pkb". Ping works successful from 1 to 2 and vice verse. But when I am trying on first server : sendmail -v user@dev.pkb < /etc/motd it is... (3 Replies)
Discussion started by: Colf
3 Replies

7. Red Hat

Mail Problem. Maybe, it is a DNS Problem!

Hi, i've a redhat linux 9 upadated by redhat from 7 version to 9 version. A couple of days ago i was a problem with my mail, in other words i'm not able to get any email nor to send any email. I've a proxy configuration and i tried to set iptables in order to verify the port. The 110,255 and 995... (1 Reply)
Discussion started by: pintalgi
1 Replies

8. UNIX for Advanced & Expert Users

HP UX mail problem

I am uxing HP UX mailx, I want to send mail with: 1) to list 2) cc list 3) sender address 4) mail body 5) subject 6) attachment I am using : (cat cc_list; cat mail_body; ux2dos file_1 | uuencode attachment.txt)|mailx -m -s "subject" -r sender@abc.com recepient@abc.com cc_list... (2 Replies)
Discussion started by: gautamadak
2 Replies

9. UNIX for Dummies Questions & Answers

Mail Problem

Hi All, I am having a problem that is very similar to the one being discussed here. I am using OS X and am trying to send mail from the OS X Terminal to my GMail account. The mail seems to go through, but gets stuck at Google's servers. I have a log file from the /var/mail directory that... (0 Replies)
Discussion started by: danielsutton
0 Replies

10. Shell Programming and Scripting

Log search and mail it if the log is updated before 24 hours from the current time

Hi , We have around 22 logs , each has different entries. I have to automate this using shell script. The ideas which am sharing is given below 1) We use only TAIL -100 <location and name of the log> Command to check the logs. 2) We want to check whether the log was updated before 24... (13 Replies)
Discussion started by: Kalaihari
13 Replies
BUGFILER(8)						      System Manager's Manual						       BUGFILER(8)

NAME
bugfiler - file bug reports in folders automatically SYNOPSIS
bugfiler [ mail directory ] DESCRIPTION
Bugfiler is a program to automatically intercept bug reports, summarize them and store them in the appropriate sub directories of the mail directory specified on the command line or the (system dependent) default. It is designed to be compatible with the Rand MH mail system. Bugfiler is normally invoked by the mail delivery program through aliases(5) with a line such as the following in /etc/aliases. bugs:"|bugfiler /usr/bugs/mail" It reads the message from the standard input or the named file, checks the format and returns mail acknowledging receipt or a message indi- cating the proper format. Valid reports are then summarized and filed in the appropriate folder; improperly formatted messages are filed in a folder named ``errors.'' Program maintainers can then log onto the system and check the summary file for bugs that pertain to them. Bug reports should be submitted in RFC822 format and aremust contain the following header lines to be properly indexed: Date: <date the report is received> From: <valid return address> Subject: <short summary of the problem> Index: <source directory>/<source file> <version> [Fix] In addition, the body of the message must contain a line which begins with ``Description:'' followed by zero or more lines describing the problem in detail and a line beginning with ``Repeat-By:'' followed by zero or more lines describing how to repeat the problem. If the keyword `Fix' is specified in the `Index' line, then there must also be a line beginning with ``Fix:'' followed by a diff of the old and new source files or a description of what was done to fix the problem. The `Index' line is the key to the filing mechanism. The source directory name must match one of the folder names in the mail directory. The message is then filed in this folder and a line appended to the summary file in the following format: <folder name>/<message number> <Index info> <Subject info> The bug report may also be redistributed according to the index. If the file maildir/.redist exists, it is examined for a line beginning with the index name followed with a tab. The remainder of this line contains a comma-separated list of mail addresses which should receive copies of bugs with this index. The list may be continued onto multiple lines by ending each but the last with a backslash (`'). FILES
/usr/sbin/sendmail mail delivery program /usr/libexec/unixtomh converts unix mail format to mh format maildir/.ack the message sent in acknowledgement maildir/.format the message sent when format errors are detected maildir/.redist the redistribution list maildir/summary the summary file maildir/Bf?????? temporary copy of the input message maildir/Rp?????? temporary file for the reply message. SEE ALSO
mh(1), newaliases(1), aliases(5) BUGS
Since mail can be forwarded in a number of different ways, bugfiler does not recognize forwarded mail and will reply/complain to the for- warder instead of the original sender unless there is a `Reply-To' field in the header. Duplicate messages should be discarded or recognized and put somewhere else. 4.2 Berkeley Distribution October 23, 1996 BUGFILER(8)
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy