CentOS 5 Server :: Cp Directory Recursively With Load Check?

Nov 21, 2010

how the bash script should look to copy huge directory with multiple sub-folders to a new place place while checking load and stopping for several seconds if load reached lets say 3 or 4 ? I only know the simple command cp -r /dir/allfiles /dir/newplace However would like to copy over 30 000 files which will cause me a high load.

View 1 Replies


ADVERTISEMENT

CentOS 5 :: Move Contents Of A Directory Recursively Including Hidden?

Mar 9, 2010

I have a directory: /var/www/html/something/

and it's got tons of files and directories, some containing hidden files.

I want to move all the contents of something including hidden files up to the site root at: /var/www/html/

What is the proper command for this?

View 4 Replies View Related

Server :: Program To Check Cpu Load?

Jul 28, 2011

my server get hanged when ever their is loading problem. i wanna a program to get cpu load and also when load get high from a specified load value it should restart service. is their is any programm or how to write that programm..

View 12 Replies View Related

Programming :: Check Server Load Via Php?

Mar 4, 2011

We have 7 webservers running in a cluster, and I have zenoss running which does monitor space, network, even performance, but I would like a nice small webpage that I could break into just a few rows of a table. I would like to be able to simple do a reload every 30/60 seconds, and just have the following;row1: server load, memory userow2: server load, memory useBefore the row, if the load > x change the css to make it red (so I could notice it), etc. The css, the refresh, etc. is all simple, I am jut wondering how I could go about getting the load and memory use from PHP.I could setup a bash script that could get the info and spit it to a file as a last resort, but curious if there was a more direct way.

View 3 Replies View Related

Ubuntu :: Recursively Copy From Directory To Another Directory

Mar 23, 2010

I'm facing a little trouble with copying a .txt file(only) from a directory and subdirectory to another directory. -R command don't work I think if I want to do this, since I don't want to copy subdirectory.

View 6 Replies View Related

Server :: Cannot Load Mcrypt Extension. Please Check PHP Configuration?

Nov 23, 2010

i have centos 5 running with apache, mysql, php and phpmyadmin. phpadmin is working well but it is showing the following error on the page:- Cannot load mcrypt extension. Please check your PHP configuration.i just try to install mcrypt but it is asking for required dependencies libmcrypt.

View 1 Replies View Related

CentOS 5 :: Check Directory For New Files And Send Email Alert

Sep 12, 2009

i have CentOS 5.2 based server running openssh, which gives sftp service to the outside users(from internet), the users from some public ip-addresses uploads and download files from sftp-server directories. I want that whenever a user uploads a new file in certain directory of server, the server should send me an email alert

View 1 Replies View Related

Fedora :: Program To Recursively Check A Web Site For Broken Links?

Sep 21, 2010

Is there a program, or command, that will allow me to recursively check a web site for broken links?

View 2 Replies View Related

General :: How To Recursively Copy Directory Into Another One

Apr 25, 2011

I moved to Mac OS X recently and bumped into the "feature" of Mac where copying files from an external drive resets the file modification/update date/timestamp to the current date (which Windows does not), causing a disaster for my 10+ years of backup work files where date is important. So, before I learned how to avoid that (e.g. using the -p "preserve" flag in the "cp" copy command) I have in the meantime added to my new Mac hard drive many more files as well as updating existing old files.

I have a backup external hard drive with all my old data and proper modification dates. I have a Mac hard drive with reset modification file dates (a single or two particular days). The Mac hard drive has all the "true" and "current" file contents with files modified and added. I need to Copy all the original files from the external harddrive, preserving file metadata (really only modified date), but ONLY overriding the new internal Mac hard drive IF

The file contents (md5 or whatever) is the same or The file was updated after the day (which of course I can see on all files) on which the original disasterous cope was performed (implying the file is new or modified) Ensure the copy leaves all the new and modified files completely intact on the Mac internal hard drive. "No prompting/stopping of the copy of any kind (i.e., not verbose) is required but is o.k". "Recursive copy - obviously I would like to copy all* files folders and subfolders found in export".

View 1 Replies View Related

Programming :: Shell Script To Check Whether Directory Exists On Remote Server

Jan 17, 2011

I am new to scripting, would like to have a script that tests whether a directory exists on remote host & display the message accordingly. The remote hostname can be provided by means of file containing list of hostnames. Can use rsh for connecting to remote host.I tried with couple of scripts by searching google but didn't get desired result. Please help me, below is my efforts, $file contains list of hostnames.

View 10 Replies View Related

General :: Recursively Download An Entire Web Directory?

Feb 3, 2010

i have a web directory that has many folders and many sub folders containing files.

i need to download everything using wget or bash.

View 7 Replies View Related

General :: Recursively Count All The Files In A Directory?

Oct 12, 2010

I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, including all of the subdirectories.

For instance, given this directory tree:

/home/blue
/home/red
/home/dir/green
/home/dir/yellow
/home/otherDir/

If I pass in /home, I would like for it to return 4 files. Or, bonus points if it returns 4 files, 2 directories. Basically, I want the equivalent of right-clicking a folder on Windows and selecting properties and seeing how many files/folders are contained in that folder.

How can I most easily do this? I have a solution involving a Python script I wrote, but why isn't this as easy as running ls | wc or similar?

View 5 Replies View Related

General :: Copy Permissions From One Directory Recursively To Another?

May 23, 2011

I have a system where the permissions of many files are messed up. I have another system that has the same files, if I put that hard drive in, without simply overwriting the files, is there a way where I can recursively set the permissions of each file to that of this other directory?

View 1 Replies View Related

General :: Get The Last Change Time Of Directory Recursively

May 28, 2011

How can I get the last time any of the files in a directory or its subdirectories has changed?
e.g

Dir - changed 1/1/1
Sub Dir 1 - changed 2/1/1
Sub Dir 2 - changed 3/1/1
File 1 - changed 10/1/1
File 2 - change 5/1/1


The output for this for Dir should be 10/1/1 (File 1 was the last modified one). Getting the last file name to be modified is a bonus but isn't necessary.

View 3 Replies View Related

Ubuntu :: Any Way To Recursively Invert All Images In Directory?

Jan 8, 2011

I need to invert the colors of a lot of images that are in different folders in the same directory, is there a way to use image magic or something to do this in only a few commands?

View 9 Replies View Related

Red Hat / Fedora :: Extracting Files In Sub Directory Recursively

Feb 27, 2010

I am new in Linux and I need to extract alot of zipped files (different format (e.g tar.gz, tar.gz2)) which are in subdirs and I do not want to go to each subdir and extract each file because it will take alot of time. Is there away to extract all files that are existing in dirs and subdir with "for loop" or is there a script that can do the job automatically.

View 1 Replies View Related

General :: Search LDAP Directory Recursively?

Oct 12, 2010

How would the command for recursive search in LDAP look like when I'm searching for "cn" or "ou"?

View 3 Replies View Related

General :: Recursively Add Read Privilege To All The Files Under A Certain Directory?

Jan 18, 2010

I'm under linux . by default, other user can't read anything under my home directory. let's see my home directory is /home/superman , and I tried to use

chmod +r /home/superman

to let others can acess files under my home directory , but it does not work .

View 1 Replies View Related

Ubuntu :: Recursively Changed Permissions In Home Directory

May 23, 2010

I did a clean install from Ubuntu 09.04 to 10.04 and restored my files from tar.
Everything worked fine until I tried my weekly rsync backup.
The permissions seemed to be causing problems, so I recursively changed all the permissions in my home directory:

Code:
~/Documents$ sudo chmod -R 644 /home/wolf/
[sudo] password for wolf:
chmod: cannot access '/home/wolf/.gvfs': Permission denied
So now all the directories and files have read permission for everyone:

Code:
~/Documents$ ls -A
ls: cannot open directory .: Permission denied
~/Documents$ sudo ls -lA
[sudo] password for wolf:
total 80
drw-r--r-- 2 wolf wolf 4096 2010-05-22 20:45 career
drw-r--r-- 23 wolf wolf 4096 2010-05-02 17:17 computer_languages
drw-r--r-- 2 wolf wolf 4096 2009-08-09 23:29 .ecryptfs
drw-r--r-- 21 wolf wolf 4096 2010-05-02 17:23 misc
-rw-r--r-- 1 wolf wolf 27298 2010-05-23 13:01 next.odt
drw-r--r-- 3 wolf wolf 4096 2010-05-23 15:46 PC_maintenance
drw-r--r-- 5 wolf wolf 4096 2010-05-08 01:43 software_projects
Now I can't even look at my own directory:

Code:
/home$ cd /home/
/home$ ls -lA
total 20
drwx------ 2 root root 16384 2010-05-07 01:01 lost+found
drw-r--r-- 42 wolf wolf 4096 2010-05-23 15:35 wolf
/home$ cd /home/wolf
bash: cd: /home/wolf: Permission denied
/home$ sudo cd /home/wolf
[sudo] password for wolf:
sudo: cd: command not found
/home$

View 2 Replies View Related

General :: Zip -x For A Directory - Subfolder Contents Not Being Excluded Recursively?

Dec 9, 2010

I am attempting to use the zip command with the '-x' option to exclude a folder e.g. 'zip upload.zip public_html -x public_html/jquery/*'. However, parts of this folder are still being added to the archive. I made a shell script (saved as 'compress.sh' and ran as '. compress.sh') to do the archiving so I could test adding nested wildards for multiple subfolder levels.

Code:

#!/bin/bash
rm -f upload.zip
zip -r upload.zip public_html
-x public_html/jquery

[code]....

Each new line I added here that has the nested wildcards made the archive file size a bit smaller. Adding more /*'s than this didn't affect the file size. Even after all this though, there were still a couple megabytes of files and folders from the 'jquery' directory that were added to the archive.

Here's some examples of files and folders that were created after I unzipped the archive:
public_html/jquery/js/tablesorter/addons/pager/icons [folder]
public_html/jquery/js/tablesorter/addons/pager/.svn/entries [file]
public_html/jquery/js/tablesorter/build/.svn/text-base/js.jar.svn-base [file]

Why is it that despite all the -x lines, the files and folders like these were still being added to the archive? How can I simply recursively exclude the entire public_html/jquery folder from the archive?

View 4 Replies View Related

Fedora :: Configure Grep To Search Recursively Through All Files In A Directory?

Oct 1, 2010

somewhere lurking is a file containing the default print resolution, which is not being overwritten by printer settings or cups management. I've asked on the cup forum and nothing successful.

So here's the question:

How can I configure grep to search recursively through all files in a directory, or if need be starting from root to find the pattern "2880" I've looked in the man page for grep and I can't see how to do it, is grep the right tool to use for this ?

View 2 Replies View Related

General :: Recursively Remove Subdirectories And Files But Not The First Parent Directory?

Feb 11, 2010

I'm able to use the following to remove the target directory and recursively all of its subdirectories and contents. find '/target/directory/' -type d -name '*' -print0 | xargs -0 rm -rf

However, I do not want the target directory to be removed. How can I remove just the files in the target, the subdirectories, and their contents?

View 4 Replies View Related

General :: Overwriting Specific Files In Directory Tree Recursively

Jul 19, 2011

I would like to overwrite files in a directory tree, recursively. The ones I would like to overwrite match the filename "x_alpha*.png" and have a size exactly 456 bytes. Is there any way to search for these recursively in a directory tree, and overwrite them with a reference file, for example "e:mydirgood.png"

I am using Windows 7, but I have UnxUtils, so I can use those too. What I am looking for is something like this, generated automatically:
copy /y e:mydirgood.png e:mydiracx_alpha0023.png
copy /y e:mydirgood.png e:mydirefgx_alpha0045.png
copy /y e:mydirgood.png e:mydirhx_alpha0248.png

View 2 Replies View Related

General :: Copying Jpegs Recursively While Preserving The Directory Structure?

Aug 9, 2010

So I have a bunch of directories:

dir1
dir2
dir3
etc.

which themselves all contain subdirectories:

dir1subdir1subdir2etc.and at the lowest level they contain all of these jpegs that I need. The problem is that I only need some of them. They're named like this:

pic1.jpg
pic1_med.jpg
pic1_small.jpg
pic2.jpg
pic2_med.jpg
etc.

I want to just grab the ones without the size suffix and copy them all to another set of folders, while preserving the directory structure. The numbering all starts at 1 for each low level subdirectory, so I think that the directory structure is the only way to not get them mixed up.

I know that cp has a recursive option -r but how do I just extract the ones without the underscore? And then how do I preserve the directory structure when I move them over?

View 1 Replies View Related

General :: Rsync Files Recursively But Place In One Remote Directory?

Jan 29, 2011

i would like to find and backup all *.mp4 files from /Pictures and its sub-directories and move them to a single directory on a remote. I can find and move the files but I don't want the directory structure...just the files to be placed in the remote directory.

To find my files I use

rsync -r -a -v -e "ssh -l user" --delete --include '*/' --include '*.mp4' --exclude '*' /home/drew/Pictures/ remoteserver:/Users/drew/mp4

but this creates all the subdirectories

I also tried

find ~/Pictures -name "*.mp4" -exec rsync -r -a -v -e "ssh -l user" --delete {} remote:/Users/drew/mp4 ;

This works but takes forever

View 3 Replies View Related

Fedora :: Bash Function Alias To Recursively Grep Current Directory?

Feb 14, 2011

This should be a simple thing to accomplish, but I can seem to figure it out. Essentially, I want to have a bash alias or function that will let me recursively grep the current directory. A while back I added this to my .bashrc:

Code:

alias rg="grep -r --exclude=*/.svn/* --exclude=*.swp"

This works fine, (and also ignores any svn and vim swp files), and I can call it like:

Code:

rg foo *

However, 99.999% of the time, I am only interested in searching in the current directory, so the "*" is a bit redundant. Also, I would say 5-10% of the time, I am typing faster than thinking and forget the "*", so grep just sits there trying to read from stdin. It's a pretty minor thing, but ideally I'd like to be able to just type:

Code:

rg foo

I've tried creating a function to handle this:

Code:

function rg(){
grep -r --exclude=*/.svn/* --exclude=*.swp $1 *
}

but it behaves exactly the same as the alias above. escaping the "*" with 's doesn't work, and neither does trying `pwd` (or even a hard-coded path) in its place.

View 2 Replies View Related

General :: Copy File Recursively Ignoring Destination Directory Structure?

Jul 8, 2011

I have the following content on the source directory:

source/foo.txt
source/bar/another_file.txt
source/bar2/and_another.txt

I want copy those files to a destination directory which, after copy, shall look like this:

destination/foo.txt
destination/another_file.txt
destination/and_another.txt

How can I do this? It seems that "cp" lacks such an option

View 1 Replies View Related

Programming :: /usr/bin/expect : Script To Check Server Load Using Both Expect And Bash?

Jul 27, 2010

I am trying to make a script that can be used to check server load on a remote server and produces sound on our local machine, when server load exceeds a particular limit.1. I want to execute command uptime or uptime | awk '{print$10}'on the remote server and store the result in a variable(say x), and later use it in the bash script.

Bash Part
#!/bin/bash
x=$(/root/Desktop/exp)

[code]...

View 1 Replies View Related

Programming :: Finding Maximum Length File In A Directory Recursively Using Shell Scripting?

Nov 8, 2010

I want to find maximum length file in a given directory. It should search recursivley. I want this to be done using ls and simple looping constructs.

View 6 Replies View Related

Programming :: Sort Oldest 5 Files In A Directory Tree Recursively Based On Timestamp?

Jun 3, 2010

I have a directory listing with many subdirectories having many files. I want to recursively search for the oldest 5 files starting from the base directory and not 5 from each subdirectory. I am writing a shell script which sorts them using ls -lRtur|egrep "txt|jpg" > /tmp/file1 Now from this /tmp/file1 file I want to sort the files same as what the ls -ltr command does that is oldest file time to newest file time first. How do I sort based on Linux time stamp? The files itself also have Linux timestamps embedded in them So I can sort based after extracting them as well if it is easier.
My /tmp/file1 has entries like below.

-rw-rw-r--. 1 usr1 usr1 705 2010-01-22 17:25 sample20100603173659.jpg

I want to get the 5 oldest files and then delete them.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved