LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-14-2010, 01:59 PM   #1
jetberrocal
Member
 
Registered: Feb 2010
Posts: 45

Rep: Reputation: 15
scp truncate text file busy - copying file is not a running binary


I am having problems with scp during a backup operation

I added a ps -ef before and after the scp operation used during the backup.

The backup is a script to backup a Zimbra Server

I am including the code segment that I am having problems

Code:
	# DRCP Section. To scp newly created archives to a remote system
	if [ "$DRCP" = "yes" ]
	then
           echo ""
	    ps -ef
           echo ""
	    CPNAME=`ls -A "$ARCHIVENAME"*`
	    SCPRC=0
	    echo "copy archive to $REMOTEHOST" remote directory $REMOTEDIR
	    if [ "$SSHKEY" = "rsa" ]
            then
		  scp -i /root/.ssh/id_rsa $CPNAME "$SSHUSER"@"$REMOTEHOST":"$REMOTEDIR"
		  SCPRC=$?
            elif [ "$SSHKEY" = "dsa" ]
            then
		  scp -i /root/.ssh/id_dsa $CPNAME "$SSHUSER"@"$REMOTEHOST":"$REMOTEDIR"
		  SCPRC=$?
            elif [ "$SSHKEY" = "rsa1" ]
            then
		  scp -i /root/.ssh/identity $CPNAME "$SSHUSER"@"$REMOTEHOST":"$REMOTEDIR"
		  SCPRC=$?
            fi
	    echo ""
	    ps -ef
           echo ""
           if [ "$SCPRC" -ne "0" ]
	      then
		    echo "Error copying archive and checksum to $REMOTEHOST"
		    mail_log
		    exit 1
              elif [ $TYPE = "full" ]
              then
		     echo "$ARCHIVENAME"
		     echo "ssh $SSHUSER@$REMOTEHOST" "rm -f $REMOTEDIR/$LAST_FULL_WEEK_$BACKUPNAME*"
		     ssh "$SSHUSER"@"$REMOTEHOST" rm -f "$REMOTEDIR"/"$LAST_FULL_WEEK"_"$BACKUPNAME"*
             fi    
	fi
I am including the log that is sent during the backup by email as attachment since is too long

How can I see which process is locking the file that is being truncated?
Attached Files
File Type: txt zimbraBackupError.txt (39.9 KB, 54 views)
 
Old 06-14-2010, 02:29 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Try lsof it shows open files.
 
Old 06-14-2010, 03:25 PM   #3
jetberrocal
Member
 
Registered: Feb 2010
Posts: 45

Original Poster
Rep: Reputation: 15
I will replace ps -ef

Quote:
Originally Posted by rweaver View Post
Try lsof it shows open files.
Thank you for your promptly response.

I will replace the ps -ef line with lsof in the code.

This script backup runs only on Saturdays, and do not have a test system that could replicate the problem sooner.
I will make the change on the code today, but I have to wait until Monday to see the outcome.

So I will have to post again in this thread next week. Sorry for the delay.
 
Old 06-24-2010, 03:56 PM   #4
jetberrocal
Member
 
Registered: Feb 2010
Posts: 45

Original Poster
Rep: Reputation: 15
I change ps -ef by lsof and this is what I got

After changing the ps -ef line to lsof I did not see why the scp reports Text File busy.

I am including the new email outcome as attachment

The attachments do not accept file larger that 256KB, but the email is 1MB large so I zipped the file.

Zip is not a permitted extension so I appended a .txt to the file name

I think the problem is some kind of timeout of the scp command.

It copies successfully various files, among them two of 4GB size, before failing with this file which is a 2~3GB file
Attached Files
File Type: txt FullBackupOutcome.txt.zip.txt (95.3 KB, 32 views)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp text file busy error seran Linux - General 4 08-12-2021 03:36 PM
cannot create regular file ...: text file busy laode Linux - General 4 11-27-2012 01:56 AM
Running make menuconfig results in text file is busy. jerel4565 Linux - Kernel 2 07-18-2009 10:40 PM
Reading text file-writting binary file cdog Programming 5 06-13-2006 11:56 AM
truncate a text file in CLI? hottdogg Linux - General 2 09-06-2005 09:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration