head	1.2;
access;
symbols
	Hobson_Rock_14Dec2009:1.2
	Hobson_Rock_16Oct2009:1.1
	Hobson_Rock_29June2009:1.1;
locks; strict;
comment	@# @;


1.2
date	2009.10.16.17.54.25;	author rob;	state Exp;
branches;
next	1.1;

1.1
date	2009.06.13.03.30.01;	author rob;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Added options "all" and "tar", no quotes.  All gets all files, but in separate
.gz files.  "tar" also gets all files, but in one big tar ball.  I also fixed
this code so that it now preserves dates.

This scripts requires the companion QNX scripts cplogs, cplogsall and cpbigtar.
@
text
@#!/bin/bash 
#
# PURPOSE:  copy log files to ~/logs/$1 in QNX 4.5.
# AUTHOR:   Rob McEwen
# DATE:     2008/12/3
#
cd "$HOME/logs"
pwd
if [ $# -eq 0 ]
    then
    echo " "
    echo " Enter directory name."
fi
if [ $# -eq 1 ]
    then
    if [ -a "$1" ] 
	then
	echo " "
	echo " $1 already exists!"
	cd $1
    else
	mkdir $1
	cd $1
    fi
    echo "Logging into $AUV_HOST"
    rsh -l $USER $AUV_HOST "(./cplogs $1;)"
    ncftpget -u dorado1 -p dorado1 $AUV_HOST  . /home/rob/logs/$1/*.gz
    gunzip *.gz
elif [ $# -eq 2 ]
    then
    if [ -a "$1" ] 
	then
	echo " "
	echo " $1 already exists!"
	cd $1
    else
	mkdir $1
	cd $1
    fi
    if [ $2 = "all" ]
	then
	echo "Logging into $AUV_HOST"
	rsh -l $USER $AUV_HOST "(./cplogsall $1;)"
	ncftpget -u dorado1 -p dorado1 $AUV_HOST  . /home/rob/logs/$1/*.gz
	gunzip *.gz
    fi
    if [ $2 = "tar" ]
	then
	echo "Logging into $AUV_HOST"
	rsh -l $USER $AUV_HOST "(./cpbigtar $1;)"
	ncftpget -u dorado1 -p dorado1 $AUV_HOST  . /home/rob/logs/$1.tgz
	tar -xvzf $1.tgz
	rm $1.tgz
    fi
fi
cd ..
echo " "
echo "getlog $1 finished."



@


1.1
log
@getlogsrob is a cygwin-side script, and cplogs is a campanion script residing
the Qnx machine under ~rob.  The purpose is for a user other than dorado1 (i.e. rob) to
be able to run a script that rsh'es into $AUV_HOST, compresses the log files,
and pulls them back.  The problem is that under cygwin, rsh only works for the
same user on Qnx.  That is, rob can rsh to rob, but not to dorado1.

The "all" argument doesn't yet work because I haven't figured out how to pass
it to cplogs.
@
text
@d15 1
a15 1
then
d30 10
a39 1
then
d43 8
a50 1
	rsh -l $USER $AUV_HOST "(./cplogs $1 all;)"
d53 1
@

