Sponsored Content
Top Forums Shell Programming and Scripting Help with ssh,tar and logging Post 302835931 by maverick_here on Tuesday 23rd of July 2013 10:30:40 AM
Old 07-23-2013
Help with ssh,tar and logging

Hi,

I'm successfully written a script which tar a directory and ssh's it over a remote server

Code:
tar cfv  - $SDIR  |  ssh $RHOST  "cat > $DDIR/backup.$BKPEXT.tar"

However, Im unable to log the activity to a file. i.e for example if I do

Code:
tar cfv  - $SDIR  |  ssh $RHOST  "cat > $DDIR/elc5.$BKPEXT.tar"  > logfile 2>&1

The logfile is empty even though the backup happens.

Please advice.

Thanks in advance

---------- Post updated at 08:00 PM ---------- Previous update was at 06:46 PM ----------

I have created a function to do the same job the tar command was doing and then I have redirected the function's output to the log file. It works.

Code:
TAR() {

   tar cfv  - $1  |  ssh $2  "cat > $3/project.tar"

 }


    TAR $SDIR $RHOST $DDIR  > $LOGFILE 2>&1

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

SSH and command logging

Hi all... I've completed the task of deploying SSH over my 400 servers. I don't know if i'm right or wrong, but ssh doesn't do any command-logging, does it? Is there a app i can use to log all commands passed ( besides the usual .sh_history), whith no modification possible by the user, and how... (2 Replies)
Discussion started by: penguin-friend
2 Replies

2. OS X (Apple)

SSH Logging?

Does anybody know if MacOS X (10.3.X) is capable of logging ssh access? I want to be able to see who has logged into my system via SSH, similar to the way Apache or FTP logs access (/private/var/logs/). The only thing that I am finding right now is the the initiation of a PID in the "system.log",... (0 Replies)
Discussion started by: esser
0 Replies

3. UNIX for Advanced & Expert Users

What change in freeBSD OS to allow root logging using ssh?

Hi everybody, ] I would like to ask just simpe and short question. I am using freeBSD 6.0 and Debian Sarge. From Debian console I can log as root using ssh to bsd mashine but not vice versa. When I say in bsd console su I got sorry output, it does not allow me to su to root when I am logged... (5 Replies)
Discussion started by: 100days
5 Replies

4. UNIX for Advanced & Expert Users

ssh not logging users

We installed ssh on our AIX 5.3 box. The issue we are facing is that we dont get the users listed when we use 'w' or 'who'. After going through google without success, checked the www.openssh.org site. The FAQ section posted the solution that - How do I go about this? Has anyone faced an issue... (2 Replies)
Discussion started by: ranj@chn
2 Replies

5. UNIX for Advanced & Expert Users

difference between logging into unix through f-secure ssh client and telnet

hi, what is the difference between logging into unix through f-secure ssh client and telnet is there any more security check is involved can any one explain thanks in advance (1 Reply)
Discussion started by: trichyselva
1 Replies

6. Shell Programming and Scripting

using SSH with my script and avoid logging in manually

Hi Guys. I have 3 variables $HOST $Username $Password I want to connect to a remote server using SFTP. usr/bin/sftp -o Cipher=blowfish $HostWhere do I put in the options for the username and pwd??? I have tried different ways and nothing works. It keeps coming back and promting me. ... (5 Replies)
Discussion started by: ramangill
5 Replies

7. UNIX for Dummies Questions & Answers

TAR OVER SSH

Hello, I have a server that has a tape drive attached to it in our company's DMZ. I want to backup the data on other servers onto this tape drive using a script. I will have to ssh into each machine and execute a tar command and instruct the tar command to send the data back to the server that... (5 Replies)
Discussion started by: mojoman
5 Replies

8. UNIX for Dummies Questions & Answers

Automatic logging (capture screen output) of telnet/ssh sessions on a Solaris node

Hi I am working in Solaris 10 and I want to monitor logs for every telnet/ssh session that tries to connect to the server. I need these logs to be generated in a file that I can fetch using ftp. I am a new user and a stepwise detail will be great BR saGGee (3 Replies)
Discussion started by: saggee
3 Replies

9. Shell Programming and Scripting

Logging Remote SSH command (cannot log a java output)

Hi all I'm creating a script that runs a few commands on some boxes and everything can be logged EXCEPT the java -version command, there doesn't seem to be any output... Can anyone help explain why this does not work? Do I need to do something extra to append the output from the java... (3 Replies)
Discussion started by: Keepcase
3 Replies

10. Shell Programming and Scripting

Tar file with logging and directory via parameter

Hi all, I am fairly new to shell scripting and I am trying the following: My shell script creates a tar file with files with the ending ~. The directory - where the files and sub directories are located - comes as a parameter when I call the script. Files that are archived will be written in... (1 Reply)
Discussion started by: neg42
1 Replies
virt-tar-out(1) 					      Virtualization Support						   virt-tar-out(1)

NAME
virt-tar-out - Pack a virtual machine disk image directory into a tarball. SYNOPSIS
virt-tar-out -a disk.img /dir files.tar virt-tar-out -d domain /dir files.tar virt-tar-out -d domain /dir - | gzip --best > files.tar.gz DESCRIPTION
"virt-tar-out" packs a virtual machine disk image directory into a tarball. The first parameter is the absolute path of the virtual machine directory. The second parameter is the tar file to write. Use "-" to write to standard output. EXAMPLES
Download the home directories from a guest: virt-tar-out -d MyGuest /home - | gzip --best > homes.tar.gz JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH
This command is just a simple shell script wrapper around the guestfish(1) "tar-out" command. For anything more complex than a trivial copy, you are probably better off using guestfish directly. OPTIONS
Since the shell script just passes options straight to guestfish, read guestfish(1) to see the full list of options. SEE ALSO
guestfish(1), virt-cat(1), virt-copy-in(1), virt-copy-out(1), virt-edit(1), virt-tar-in(1), <http://libguestfs.org/>. AUTHORS
Richard W.M. Jones ("rjones at redhat dot com") COPYRIGHT
Copyright (C) 2011 Red Hat Inc. <http://libguestfs.org/> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. libguestfs-1.18.1 2013-12-07 virt-tar-out(1)
All times are GMT -4. The time now is 07:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy