Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Routing a verbose information to a log file Post 302411238 by raghuveer2008 on Thursday 8th of April 2010 04:08:27 AM
Old 04-08-2010
Routing a verbose information to a log file

Hi All,

In the script mentioned below uses a sftp command to login to the remote host and pull the files from the remote server. we want to log this inf to a log file . But it is not happening, the verbose information is just displayed on the screen but not to the log file when I run this script. Please let me know which is the correct syntax:


Code:
 sftp -v   test@remotehost >>test.log_$(date +%Y%m%d) <<EOF
lcd  tempdir
        get remotedir/*
        rm remotedir/*
EOF
cd tempdir
if [ `ls | wc -l` -eq 0 ]
then
        echo "NOFILE"
        exit
else if [ `ls | grep -i ".cnf" | wc -l` -eq 0 ]
then
        echo "NOCNFFILE"
        exit
fi
fi
for cnffile in `ls | grep -i ".cnf"`
do
payloadfile=`echo $cnffile|sed 's/\..\{3\}$//'`
if [ -f $payloadfile ]; then
        mv $payloadfile localdir/clientid_$payloadfile
        mv $cnffile localdir/clientid_$cnffile
fi
done
        if  [ $? = 0 ]
        then
                echo "SUCCESS"
        else
                echo "FAIL"
        fi
 
#EOF
#echo $?


Last edited by pludi; 04-08-2010 at 05:48 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sftp verbose output

We need to use sftp to replace the ftp on all our application scripts. The command itself works, however,the output from the verbose is not giving us a success response with a transfer count. Our processes require that we interrogate the response to ensure the data transfer was successful. ... (2 Replies)
Discussion started by: MizzGail
2 Replies

2. Shell Programming and Scripting

Getting cURL to output verbose to a file

This is about to drive me crazy. What I want to do is simple: output ALL the verbose information from curl to a file I have read the manual, tried several options and searched this forum but no salvation... I'm using curl -k -Q "command" --user user:passwd --ftp-pasv --ftp-ssl -v... (1 Reply)
Discussion started by: caramandi
1 Replies

3. Shell Programming and Scripting

Extract information from Log file formatted

Good evening! Trying to make a shell script to parse log file and show only required information. log file has 44 fields and alot of lines, each columns separated by ":". log file is like: first_1:3:4:5:6:1:3:4:5:something:notinterested second_2:3:4:3:4:2 first_1:3:4:6:6:7:8 I am interested... (3 Replies)
Discussion started by: dummie55
3 Replies

4. Shell Programming and Scripting

extract information from a log file (last days)

I'm still new to bash script , I have a log file and I want to extract the items within the last 5 days . and also within the last 10 hours the log file is like this : it has 14000 items started from march 2002 to january 2003 awk '{print $4}' < *.log |uniq -c|sort -g|tail -10 but... (14 Replies)
Discussion started by: matarsak
14 Replies

5. Shell Programming and Scripting

Extract various information from a log file

Hye ShamRock If you can help me with this difficult task for me then it will save my day Logs : ================================================================================================================== ... (4 Replies)
Discussion started by: SilvesterJ
4 Replies

6. Shell Programming and Scripting

Grep'ing information from a log file on SUN OS 5

Hi Guys, I'm trying to write an script that will be launched by a user. The script will look at a log file and check for alerts with the date (supplied by user) and a machine's hostname (also supplied by the user). I'm trying to get the output formatted just like the log file. The logfile looks... (5 Replies)
Discussion started by: illgetit
5 Replies

7. Shell Programming and Scripting

Feeding information in columns of LOG file

Dear all, I want to write a shell script to easy my job. Here is the description of task: I have several files (d1.log, d2.log, d3.log etc) with the common text as =======using photon counter ====== tot pho is = 29596 nomatch pho is = 1350 phoeta pho is = 1220... (11 Replies)
Discussion started by: nrjrasaxena
11 Replies

8. Shell Programming and Scripting

Getting information out of a log file

Hello guys, I am trying to filter some information out of a log file (example shortcut) ===== fspCIV0 /vol/vol0 -sec=sys,rw=fspsanp42.net,root=fspsanp42.net,nosuid ===== fcvCIS01 /vol/ARDW -sec=sys,rw /vol/ARDW -sec=sys,rw /vol/ARDW -sec=sys,rw,nosuid /vol/ARDW -sec=sys,rw... (2 Replies)
Discussion started by: linux_scrub
2 Replies

9. UNIX for Dummies Questions & Answers

Verbose command cp

Hi, I have sometimes a problem when i want to copy files from a nas, it's the nas which have a problem when it is very requested by a lot of users, the command cp turn and don't stop (the file size does not increase) and it's lock. Is it possible to verbose this command ? I try with the flag... (1 Reply)
Discussion started by: protocomm
1 Replies

10. SCO

Stopping Routing Information Protocol

Hi, I'm a Linux Admin and have been given a SCO unix box to look after. One of the tasks that I need to complete is to stop the server running Routing Information Protocol. From what I've read I need to stop the routed process. However, I don't know if it's as simple as killing the process... (1 Reply)
Discussion started by: stevanbt
1 Replies
sftp-server(1M) 					  System Administration Commands					   sftp-server(1M)

NAME
sftp-server - SFTP server subsystem SYNOPSIS
/usr/lib/ssh/sftp-server [-f log_facility] [-l log_level] DESCRIPTION
sftp-server implements the server side of the SSH File Transfer Protocol as defined in the IETF draft-ietf-secsh-filexfer. sftp-server is a subsystem for sshd(1M) and must not be run directly. Command-line flags to sftp-server should be specified in the Subsys- tem declaration. See sshd_config(4) for more information. To enable the sftp-server subsystem for sshd add the following to /etc/ssh/sshd_config: Subsystem sftp /usr/lib/ssh/sftp-server See sshd_config(4) for a description of the format and contents of that file. There is no relationship between the protocol used by sftp-server and the FTP protocol (RFC 959) provided by in.ftpd. OPTIONS
Valid options are listed below. As stated above, these are to be specified in the Subsystem declation of sshd_config. -f log_facility Specifies the facility code that is used when logging messages from sftp-server. The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The default is AUTH. -l log_level Specifies which messages will be logged by sftp-server. The possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. INFO and VERBOSE log transactions that sftp-server performs on behalf of the client. DEBUG and DEBUG1 are equiva- lent. DEBUG2 and DEBUG3 each specify higher levels of debugging output. The default is ERROR. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/usr/lib/ssh/sftp-server Server-side binary. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsshdu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
sftp(1), ssh(1), ssh-add(1), ssh-keygen(1), sshd(1M), sshd_config(4), attributes(5) SunOS 5.11 24 Oct 2007 sftp-server(1M)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy