Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 13th November 2006, 22:43
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Unhappy Sudden Problem Started using cp: command "omitting directory"

Hi All,

Thanks in advance to anyone that can help me with this one...

Just today, I'm having problems using the cp: command:

1. Suddenly, -i (interactive) is forced upon me, even if I didn't call for it.

2. If I use " -f ", I get an interactive prompt.

3. I get directory not found, or "directory omitted" for the following commands, that * worked fine * up until today:

Code:
find /var/www/web1*/web/bmres*/myfolder/ -maxdepth 1 -type d | awk '{print "cp -f -R /home/searchfeed.php "$1"/"}' | /bin/sh
makes error

Code:
: No such file or directory: line 12: /bin/sh
OR, if I call it simply from the shell, as in the following:

Code:
cp -f /home/searchfeed.php /var/www/web1*/web/site*/myfolder
makes errors:

Code:
cp: omitting directory `/var/www/web199/web/site_source_aaaadn0/myfolder'
for EVERY web folder and site_source folder within the web1* call!

What's up, these commands worked fine a few days ago!

Reply With Quote
Sponsored Links
  #2  
Old 14th November 2006, 15:34
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Quote:
Originally Posted by bpmee
OR, if I call it simply from the shell, as in the following:

Code:
cp -f /home/searchfeed.php /var/www/web1*/web/site*/myfolder
You are using wildcards for the target directory. Are you sure you want this?

Quote:
: No such file or directory: line 12: /bin/sh
In which script do you get this?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 14th November 2006, 15:48
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Unhappy I get that error in the first script with I listed containing the "awk" command

Hi Falko,

Thanks for your reply.

I get that error in the first script I mentioned, the one containing the "awk" command...

I want to use wildcards because I have many folders and divided into various sections throughout each "web1*" designation....

I'm not sure why this is suddenly happening - I had no troubles before yesterday!
Reply With Quote
  #4  
Old 15th November 2006, 15:46
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Quote:
Originally Posted by bpmee
I get that error in the first script I mentioned, the one containing the "awk" command...
Please post the contents of that script here.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 15th November 2006, 22:54
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Default Here's the code bit

Hi Falko,

Here's the code.... note, I use various iterations of it, such as web2*, web3*, etc because of the extreme amount of folders and sites on my server...

Code:
find /var/www/web1*/web/site*/myfolder/ -maxdepth 1 -type d | awk '{print "cp -f -R /home/searchfeed.php "$1"/"}' | /bin/sh
echo bm1
* Note, the double wild card is on purpose....

THANKS!
Reply With Quote
  #6  
Old 16th November 2006, 16:10
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Why do you pipe the output of the command through /bin/sh?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 16th November 2006, 17:08
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Default I borrowed this code piece from another script I saw

Hi Falko,

I found this code originally from another shell script on the web.

I just tried running it without the | /bin/sh and the shell showed the cp command, but nothing was actually copied...

The output was like the following:

Code:
cp -f /home/searchfeed.php /var/www/web35/web/site_source_aaaafa4/myfolder
Despite this output the file was not copied! Note, I'm trying to overwrite an existing file with a new version - perhaps I need to provide a command to remove this old file first?

I'm hesitant to do this only because I don't want to accidentally erase other files......
Reply With Quote
  #8  
Old 17th November 2006, 14:58
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Can you post your full script here, not just an excerpt?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #9  
Old 20th November 2006, 16:59
bpmee bpmee is offline
Member
 
Join Date: Aug 2006
Posts: 86
Thanks: 3
Thanked 7 Times in 6 Posts
Default Here's the code

Hi Falko,

This is the full code:

Code:
##
##
find /var/www/web0*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm0
find /var/www/web1*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm1
find /var/www/web2*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm2
find /var/www/web3*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm3
find /var/www/web4*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm4
find /var/www/web5*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm5
find /var/www/web6*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm6
find /var/www/web7*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm7
find /var/www/web8*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm8
find /var/www/web9*/web/bmres*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo bm9
##
##
##
find /var/www/web0*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site0
find /var/www/web1*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site1
find /var/www/web2*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site2
find /var/www/web3*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site3
find /var/www/web4*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site4
find /var/www/web5*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site5
find /var/www/web6*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site6
find /var/www/web7*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site7
find /var/www/web8*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site8
find /var/www/web9*/web/site*/ -maxdepth 1 -type d | awk '{print "cp -f /home/searchfeed.php "$1""}'
echo site9
##
##
Reply With Quote
  #10  
Old 21st November 2006, 15:27
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
 
Default

Please put
Code:
#!/bin/bash 
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin
right at the beginning of the script.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
postfix problems with smtp linkdeb Server Operation 13 15th March 2014 17:58
Strange email problem for one of my domains... any help appreciated paulrobert_a Installation/Configuration 5 9th August 2010 14:15
sending e-mail using mail() function linuxuser1 HOWTO-Related Questions 38 21st April 2009 12:20
problem with load-balanced mysql cluster MvdB HOWTO-Related Questions 4 16th October 2006 11:15
Postfix+MySQL Problem jasutton Installation/Configuration 1 15th June 2006 16:06


All times are GMT +2. The time now is 00:38.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.