LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-20-2005, 08:10 AM   #1
seran
Member
 
Registered: Aug 2004
Location: Bangalore
Posts: 64

Rep: Reputation: 16
scp text file busy error


Hello,
I used to transfer some bin files from my local machine to a remote machine using scp. I copy my local file with the same name onto the remote machine. Sometimes if the bin on the remote machine(which was copied previously) is in execution scp fails with a message 'text file busy'.

[seran@zach-linux Bin]$ scp -B MyFile root@<remote machine ip>:/pluto/MyFile
scp: /pluto/MyFile: Text file busy

My scp works using batch mode, to avoid asking password everytime. I googled for this message, seriously I didnt find anything useful.

Currently what I am doing is, I do a ssh to that remote machine, kill that process and again I do scp from my machine. This is not convenient. Is there anyway to avoid this error.
 
Old 09-21-2005, 04:58 AM   #2
rodeoclown
Member
 
Registered: Feb 2003
Posts: 44

Rep: Reputation: 15
Well, the file on the remote machine is being used by an executable. You can't overwrite a file being used by another program. The only work around I would think of is to write a bash script to ssh into the machine, kill the process and then perform the scp of the file. Basically the same steps your taking now except you don't have to do it all manually.
 
Old 09-21-2005, 08:06 AM   #3
seran
Member
 
Registered: Aug 2004
Location: Bangalore
Posts: 64

Original Poster
Rep: Reputation: 16
thanks for the reply. I got it. this is what I did.

[seran@seran seran]$ cat upload.sh
#!/bin/bash

ssh -l root <remote machine ip> pkill -9 MyFile
scp -B MyFile root@<remote machine ip>:/pluto/MyFile
 
Old 03-24-2010, 09:21 AM   #4
TomOnTime
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
If you don't want to kill the process, you don't have to. You can rename the file and write a new file by the old name.

ssh -l root <remote machine ip> mv MyFile MyFile.still-running
scp -B MyFile root@<remote machine ip>:/pluto/MyFile

The running program is associated with the inode of the file, not the name of the file. By renaming the file, it retains the inode but frees up the name.

You can "rm MyFile.still-running" and the program will continue to run. The disk space won't be deallocated until the "use count" of the inode drops to zero. That is, until the last process using that binary exits.

For the same reason, you can eliminate the step of renaming the file and instead just delete it.
ssh -l root <remote machine ip> rm MyFile
scp -B MyFile root@<remote machine ip>:/pluto/MyFile

Understanding how inodes work in Unix is key to understanding how the Unix file systems work, and thus how to resolve problems like this. There are websites and, obviously, Unix internals books, that explain this all.

Tom
EverythingSysadmin.com
 
Old 08-12-2021, 03:36 PM   #5
eagle-dot
LQ Newbie
 
Registered: Aug 2021
Posts: 1

Rep: Reputation: Disabled
how to resolve "scp text file busy error"

Usually this is a binary file ( executable) when you have an error "SCP: <xyzbin> text file busy". What you need is to kill the process associated with xyzv=bin

1) $ ps aux | grep xyzbin
2) if the process id is 12347, then run the following command
$ kill -9 12347


3) then run your scp again. It should work


scp <localfile> <login@remote_host>:<full-path> --- copy a local file to remote host

scp login@remote-host>:<full-path>/file <local-path> .... copy a file from a remote host to local host


ex. scp xyzbin test@10.0.5.185:/home/mwu/program1/bin/

scp test@10.0.5.185:/home/mwu/program1/bin/xyzbin .
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SCP: No such file or directory...but its there!? Baix Linux - Newbie 20 07-28-2012 02:42 PM
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
/etc/rc.sysinit: /bin/awk: Text file busy teeno Linux - Software 5 02-23-2005 02:19 AM
convert error messages to text file creilar Linux - Newbie 1 05-26-2004 10:58 AM
SCP ??? where did the file go ?????? lub0 Linux - Security 3 10-07-2003 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:00 PM.

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