Unix administration - netcat, tar don't work under cron/at

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > October 2005 > netcat, tar don't work under cron/at





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author netcat, tar don't work under cron/at
henrik@segeberg.de

2005-10-24, 3:49 pm

Hello newsgroup,

i am trying to copy some files from one machine to the other,
automatically.

therefore i created two scripts, which are using tar and netcat. one is
the sender and
the other the recipient:

#!/bin/sh
# Skriptname: copy_sender.sh
cd /var/log
/bin/tar -cv save/* | /usr/bin/netcat 192.168.20.1 2265

#!/bin/sh
# Skriptname: /root/bin/copy_recipient.sh
cd /backups
/usr/bin/netcat -l -p 2265 -w 420 | /bin/tar xv

when i run them on the command-line (recipient first), everthing is
fine. The files get transfered
as expected.

however, when i run the recipient from "at" or "cron" i get an email
containing the errormessage

save/messages-20041110.gz
tar: Unerwartetes Dateiende im Archiv. (unexpected end of file in
archiv)
tar: Unerwartetes Dateiende im Archiv. (unexpected EOF in archiv)
tar: Nicht behebbarer Fehler: Programmabbruch. (unrecoverable error:
aborting)

i tried it with different types of files (html, big text files, just
tar, tgz)
under at/cron it doesn't work. The transfer is started but it doesn't
complete.

I also tried to send it from/to localhost.
There is a enough free space on both machines.

Both machines are running linux (kernel 2.6.5).

tar (GNU tar) 1.13.25
Copyright =A9 2001 Free Software Foundation, Inc.

at version 3.1.8

netcat [v1.10]

Does anybody have any suggestion why this does work from the shell but
not under at/cron ?

Thanks in advance
Henrik

Mark Hittinger

2005-10-24, 3:49 pm

henrik@segeberg.de writes:
>#!/bin/sh
># Skriptname: copy_sender.sh
>cd /var/log
>/bin/tar -cv save/* | /usr/bin/netcat 192.168.20.1 2265

^^
this should be -c v is bad in the origination case

Later

Mark Hittinger
bugs@pu.net
henrik@segeberg.de

2005-10-24, 3:49 pm

I tried it without verbose on the sender side but it doesn't change
anything. The first file is partly transfered and it is interrupted
with the following output:

save/messages-20050615.gz
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

original file size is 342076 bytes, only 7680 bytes get transfered.

Thanks
Henrik Lohse

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com