Sponsored Content
Full Discussion: Weird tail output over ssh
Top Forums Shell Programming and Scripting Weird tail output over ssh Post 302590466 by delphys on Monday 16th of January 2012 10:21:16 AM
Old 01-16-2012
Weird tail output over ssh

Hello;

Am trying to correct the formatting of tail output over ssh.
Using the following code:

Code:
echo "" > $FILE
for BOX in $SERVERS
do
echo "Processing on $BOX" |tee -a $FILE
echo "===============================" >> $FILE
sudo ssh $BOX 'TERMINAL="vt100" /usr/bin/sh -s' < /home/dsljseo/backup.template.sh >> $FILE
#sudo ssh $BOX "tail -3 /ulogs/dba_logs/backups/$BOX-bck.log" >> $FILE
echo ""
done

Code:
cat backup.template.sh
#!/bin/sh

for i in $(find /ulogs/dba_logs/backups -type f -mtime -3 -name "*-bck.log")
do
        echo "======> $i <======="
        tail -5 $i
        echo ""
done

Output I am getting:

Code:
  Processing on atb
  ===============================
  ======> /ulogs/dba_logs/backups/asi-bck.log <======= Process 147 found Sun Jan 15 16:19:02 MST 2012 Process 147 found Sun Jan 15 16:20:00 MST 2012 Process 147 found Sun Jan 15 16:21:01 MST 2012 Backups Complete - Process 147 not found
  ** End backup Sun Jan 15 16:22:03 MST 2012 **

Desired output:

Code:
  Processing on atb
  ===============================
  ======> /ulogs/dba_logs/backups/asi-bck.log <======= 

Process 147 found Sun Jan 15 16:19:02 MST 2012 

Process 147 found Sun Jan 15 16:20:00 MST 2012 

Process 147 found Sun Jan 15 16:21:01 MST 2012 Backups Complete - Process 147 not found
  ** End backup Sun Jan 15 16:22:03 MST 2012 **

Anything I am missing here ??
Thank you for any ideas

---------- Post updated at 10:20 AM ---------- Previous update was at 10:18 AM ----------

Correction:
Code:
 Processing on atb   ===============================   ======> /ulogs/dba_logs/backups/asi-bck.log <=======   Process 147 found Sun Jan 15 16:19:02 MST 2012  Process 147 found Sun Jan 15 16:20:00 MST 2012  Process 147 found Sun Jan 15 16:21:01 MST 2012 
Backups Complete - Process 147 not found   ** End backup Sun Jan 15 16:22:03 MST 2012 **

---------- Post updated at 10:21 AM ---------- Previous update was at 10:20 AM ----------

Please disregard my correction, Thnx
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Output from tail to a user

Hi all I've read through a few of these lists but can't find a right combination of answers (I can create VPN's but can't send an email!) Ok - I'm using taper as backup software which generates a log file called taper_log I want the last eight lines of this log file to be sent to a specified... (3 Replies)
Discussion started by: ifan
3 Replies

2. UNIX for Advanced & Expert Users

Weird SSH issue

hey all, I guess I'm the newbie on these boards, anyways, hello. I recently became the admin for a few Solaris machines, and I have recently discovered an issue with SSH on one of my machines. On one of my machines, I can only SSH into the machine as root. I have tried the newest version... (6 Replies)
Discussion started by: AKM
6 Replies

3. AIX

Weird bootlist output

just setup a new system today - 9117 570, using HMC for console but not partitioned. I installed this system twice. the first time it started off as 5300-00, then updated to ML03. before the update, I believe I mirrored the rootvg, and then altered the bootlist, at that point, the display was... (4 Replies)
Discussion started by: davew1099
4 Replies

4. Shell Programming and Scripting

weird echo output?

#!/bin/bash INPUT=$1 if then INPUT=0$1 TRACKNUMBER=$INPUT fi TRACKNUMBER=$INPUT echo "Track Number:" $TRACKNUMBER if then echo "File Does Not Exist!: split-track"${TRACKNUMBER}".wav" exit 0 fi CUEFILE="$2" (6 Replies)
Discussion started by: TinCanFury
6 Replies

5. Shell Programming and Scripting

format of output is weird

hi all, have a ksh script which connects to a database and runs a sql and dumps it to a '.csv' file. The problem is the result is in multiple rows with long spaces in between when it should be just a single line and this screws up the format in the '.csv' file. script is : #!/bin/ksh... (1 Reply)
Discussion started by: cesarNZ
1 Replies

6. UNIX for Dummies Questions & Answers

weird 'ls' output

Hi, Anyone knows why I can't display the contents of my directory and how to fix this? http://i50.tinypic.com/4smfth.jpg Thanks in advance for any advise. Deanne Double post. Continued here. (0 Replies)
Discussion started by: Deanne
0 Replies

7. Shell Programming and Scripting

In bash getting weird output from function ?

My script- result="" times() { echo "inside the times function" result=8 echo "Inside function $result" return $result } result=$(times) echo "the value is "$? echo "the value of result $result" when I run I get this, why the value still remain 0. $ ./func the value is 0 the value... (5 Replies)
Discussion started by: boy18nj
5 Replies

8. Shell Programming and Scripting

Traceroute script weird output

This script is giving weird output #!/bin/bash NETPATH=(`/bin/traceroute -n 4.2.2.2 | awk '{print $2}'`) for i in "${NETPATH}" do echo $i done The output: to 11.11.11.1 1.1.1.1 99.111.208.2 traceroute_test.sh traceroute_test.sh (7 Replies)
Discussion started by: thumbs
7 Replies

9. HP-UX

[Solved] Weird 'ls -l' output

Hello folks, I've found an HP-UX server with a rare 'ls -l' output. Please see the attached file. Anybody knows how can I change the output to not have this extra tabulations? Thanks in advance! (10 Replies)
Discussion started by: carpannav
10 Replies

10. UNIX for Advanced & Expert Users

Weird output from ps command

Hi Guys, I am regular Solaris user. I came across a weird problem that puzzled me. Hope you guys can help. I found that process's state(command & arguments) in two different variants of ps command is different. Can anyone explain how is this possible? bash-3.2$ ps -eLo pid,s,comm,args |... (2 Replies)
Discussion started by: brij123
2 Replies
SSH-COPY-ID(1)						      General Commands Manual						    SSH-COPY-ID(1)

NAME
ssh-copy-id - install your public key in a remote machine's authorized_keys SYNOPSIS
ssh-copy-id [-i [identity_file]] [user@]machine DESCRIPTION
ssh-copy-id is a script that uses ssh to log into a remote machine and append the indicated identity file to that machine's ~/.ssh/autho- rized_keys file. If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if this: ssh-add -L provides any output, it uses that in preference to the identity file. If the -i option is used, or the ssh-add produced no output, then it uses the contents of the identity file. Once it has one or more fin- gerprints (by whatever means) it uses ssh to append them to ~/.ssh/authorized_keys on the remote machine (creating the file, and directory, if necessary.) NOTES
This program does not modify the permissions of any pre-existing files or directories. Therefore, if the remote sshd has StrictModes set in its configuration, then the user's home, ~/.ssh folder, and ~/.ssh/authorized_keys file may need to have group writability disabled manu- ally, e.g. via chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys on the remote machine. SEE ALSO
ssh(1), ssh-agent(1), sshd(8) OpenSSH 14 November 1999 SSH-COPY-ID(1)
All times are GMT -4. The time now is 12:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy