LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2022, 10:19 AM   #1
pragovnj
LQ Newbie
 
Registered: Apr 2022
Posts: 1

Rep: Reputation: 0
mv -t not working


Hi,

My first post!

I have inherited an old perl script, ohdr_cucp_sip_fix_04132022.pl and now trying it on Linux.

It was working on Unix.


While executing, I run into one issue. it moves the Config file

The script moves the files after completion

......................
if ( ! $DRYRUN ) {
rename "$CONFIG_FILE.processing", "$CONFIG_FILE.completed" or logNdie "$PROGNAME: ERROR: Cannot rename $CONFIG_FILE to $CONFIG_FILE.completed\n";
my $c = "$CONFIG_FILE.completed";
write_log "Moving to Done: $c\n";
chomp(my $qxout=qx(mv -t $DONE_DIR $c 2>&1));
logNdie "$PROGNAME: ERROR: Move to Done FAILED($?) for $c (output='$qxout')\n" if $?;
}

But it fails near the chomp(my $qxout=qx(mv -t $DONE_DIR $c 2>&1));
I suspect it is because Linux doesn’t like the move expression

I get an error

Mon Apr 18 13:06:49 2022:ABORTING: logNdie : ohdr_cucp_sip_fix_04132022.pl: ERROR: Move to Done FAILED(256) for SIP_CUCP_FILES_VNISIPSUCCESS_20220414132902_1.cnfg.completed (output='mv: unrecognized option: t
BusyBox v1.27.2 (2018-06-06 09:08:44 UTC) multi-call binary.

Usage: mv [-fin] SOURCE DEST
or: mv [-fin] SOURCE... DIRECTORY

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY

-f Don't prompt before overwriting
-i Interactive, prompt before overwrite
-n Don't overwrite an existing file')

Mon Apr 18 13:06:49 2022:Email subject: '[Fatal ERROR]: ZLDCDYH1BDCE2D14-VCC-VOIPOHDR-CORRELATOR-0() : ohdr_cucp_sip_fix_04132022.pl: ERROR: Move to Done FAILED(256) for SIP_CUCP_FILES_VNISIPSUCCESS_20220414132902_1.cnfg.completed (output='mv: unrecognized option: t'
Mon Apr 18 13:06:49 2022:Created ABORT file: /tmp/err.ohdr_cucp_sip_fix_04132022.pl.20220418130639.15665
sh: syntax error: unterminated quoted string
ohdr_cucp_sip_fix_04132022.pl: ERROR: Move to Done FAILED(256) for SIP_CUCP_FILES_VNISIPSUCCESS_20220414132902_1.cnfg.completed (output='mv: unrecognized option: t


When I just tried with mv, I got

ohdr_cucp_sip_fix_04132022.pl: ERROR: Move to Done FAILED(256) for SIP_CUCP_FILES_VNISIPSUCCESS_20220414132902_1.cnfg.completed (output='mv: can't rename '/opt/app/vcc/pvc/ohdr/instance-0/cucp': Not a directory')
bash-4.4$

Actually the $Done_DIR = /opt/app/vcc/pvc/ohdr/instance-0/cucp

Any idea to resolve this?

Thanks,
 
Old 04-19-2022, 10:23 AM   #2
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Is that a script or binary?
If a script then you can look for where the mv command is and change the options.
Code:
Usage: mv [-fin] SOURCE DEST
or: mv [-fin] SOURCE... DIRECTORY

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY

-f Don't prompt before overwriting
-i Interactive, prompt before overwrite
-n Don't overwrite an existing file')
These are conflicting options
-f says to not prompt
-i says to prompt
-n says 'do not overwrite' which makes the other 2 moot.


As far as the -t option I guess that some versions of mv may not support that option (mine does) but the real error I see here is
Code:
sh: syntax error: unterminated quoted string
   and
(output='mv: can't rename '/opt/app/vcc/pvc/ohdr/instance-0/cucp': Not a directory')
 
1 members found this post helpful.
Old 04-19-2022, 11:07 AM   #3
lvm_
Member
 
Registered: Jul 2020
Posts: 937

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
Your script expects a full linux system with proper commands but you are running it on busybox which is commonly used on embedded linux - routers and such, has limited functionality and doesn't support -t switch for mv among other things. You are not telling anything about your system, but try using a proper external /bin/mv and a shell like bash if it has them.

Last edited by lvm_; 04-20-2022 at 01:59 AM.
 
1 members found this post helpful.
Old 04-19-2022, 01:26 PM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,804

Rep: Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203
Try to replace
Code:
mv -t $DONE_DIR $c 2>&1
with
Code:
mv $c $DONE_DIR 2>&1
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount command not working in chroot. and now chroot not working mohit.jain Linux From Scratch 5 07-14-2006 03:57 AM
Intel sound not working, usb modem not working. siriusb Linux - Hardware 8 03-04-2006 10:16 PM
samba working, then installed openSSL and not samba not working hamish Linux - Networking 3 05-17-2004 01:50 PM
Ethernet Adapter not working or Network not working... phoenix07 Linux - Hardware 2 04-09-2004 06:58 PM
cannot download files in mozilla -save dialog not working, galeon not working cmisip Linux - General 0 08-03-2003 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:15 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