Variable TIME

Hello.

I need to capture files from a server with format XXXYYYYMMDDHHMMSS.tar.gz, I have defined the DATE but how I can resolve the issue of time?

Best regards.
Rob

What's the issue?

What in unix command terms is "capture"? Please give examples of commands which work.

What Operating System and version are you using? If the target server is different, what does it run?
What Shell do you prefer?

Reading between the lines I guess that this is a wildcard question. The solution depends on context.

man date

       %k     hour ( 0..23)
       %M     minute (00..59)
       %S     second (00..60)

Sorry to all.
SunOS devsap 5.10 Generic_125100-09 sun4u sparc SUNW,Sun-Fire-V240
I'm try to get a file from server X with a shell script.
This file in server X have the format "......YYYYMMDDHHMMSS.tar.gz".
I defined one variable DATE=`date +%Y%m%d%H%M%S` but I can never to get the file.
How I can solve the time?.
Best regards.
Robert.

It probably has the timestamp based on the file's creation time. Unless that file has precreated files for each possible second during the day you won't get any files by using the current time.

Yes Perderabo, this is the question.
I think not use %H%M%S and to create a variable and set value greater zeros (set -gt zeros) and so on. I don't know.
I'll try other options, when I have the solution I will write in this forum.
Many thanks for your collaboration and patience.
Roberto.

You don't give us enough information to be able help much. If you're using ftp and if there is only one file per day you could switch from get to mget and use a wildcard for the time.

I agree with Perderabo. The lack of basic information is frustrating.

Please post the Script which does not work and detail about your environment.

We have reached post #9 without having a clue about how you "capture" files in your environment.
What do you type when you "capture" a single file manually? Does it work?

Hi.
Forget �capture�.
Script:

PROG=`basename $0`
HOST=`uname -n`
HOME="/interface"
IN="$HOME/sacct/in"
BACKIN="$IN/backin"
DATE=`date +%Y%m%d%H%M%S`
set TIME -gt zeros
LOG=$HOME/sacct/log/${DATE}.log
TMP="$HOME/sacct/tmp"
LIB="$HOME/lib"
DIR_DEST="/SACCT/GL/OUT"
BACK_DEST="bckout"
USER=ftpsacct
PA=xxxxxxx
SERVER_DEST="10.1.10.53"
FASCII="procesargl.txt"
END_FILE="CCTSAPGL$DATE.end"
TARGET_FILE="CCTSAPGL$DATE.tar.gz"
TAR_FILE="CCTSAPGL$DATE.tar"
FILE="CCTSAP*"
ZZZ="1"
MAIL_ADM="root"
MAIL_DEV="sacct"

echo "ARCHIVO TAR"
echo "open $SERVER_DEST" > $TMP/cfgftp
echo "user $USER $PA" >> $TMP/cfgftp
#echo "cd $DIR_DEST" >> $TMP/cfgftp
echo "binary" >> $TMP/cfgftp
echo "del $END_FILE" >> $TMP/cfgftp
echo "get $TARGET_FILE" >> $TMP/cfgftp
echo "bye" >> $TMP/cfgftp

log "Consigue archivo de informacion."
INTENTO=1 #Counter de intentos de ejecucion
while [ $INTENTO -le 3 ]
do
log "Comenzando intento $INTENTO..........."
ftp -i -n < $TMP/cfgftp > $TMP/targetlog 2>&1
if [ -s $TMP/targetlog ]
then
  log "Fallo intento $INTENTO para traer archivo de informacion."
  INTENTO=`expr $INTENTO + 1`
  test $INTENTO -le 3 && log "Durmiendo $ZZZ seg." && sleep $ZZZ
else
  INTENTO=4
fi
done

if [ -s $TMP/targetlog ]
then
  log "No hay conexion con $SERVER_DEST o no se encuentra $TARGET_FILE"
  log " >>> RESULTADO del FTP VERIF:"
  log "`cat $TMP/targetlog`"
  log " <<<"
  rm $TMP/targetlog
  rm $TMP/cfgftp
  send_mail "No hubo conexion con server $SERVER_DEST o no se encontro el archivo $TARGET_FILE."
  send_mail_dev "No hubo conexion con server $SERVER_DEST o no se encontro el archivo $TARGET_FILE."
  log "Recreando ascii file con los archivos existentes."
  ls $FILE > $FASCII
  log "Proceso terminado."
  exit
else
  log "Archivo $TARGET_FILE transferido exitosamente. Se continua procedimiento."
  rm $TMP/targetlog
  rm $TMP/cfgftp
fi

How I can solve the time hhmmss?.

Well since you are using ftp, my mget suggestion looks good. Just use an asterisk for the time.