Server :: Backup One Liner Find Xargs CP

May 25, 2011

I will eventually script this but wanted to know where I screwed up when trying to get this oneliner to work. In a nutshell, I want to created a backup directory, find any files that have changed in the last 48hrs and them copy them to the newly made backup directory.

PHP Code:
date=$(date +%m%d%Y)mkdir -p /home/test_dir/backup$date;find . -mtime 1|xargs -0 cp -r -t /home/test_dir/backup$date

When I do this I get:
PHP Code:
a bunch of junk !#$#$$#! File name too long

I also tried:
PHP Code:
date=$(date +%m%d%Y)mkdir -p /home/test_dir/backup$date;find 
. -mtime 1|xargs -0 cp -r {} /home/test_dir/backup$date

View 7 Replies


ADVERTISEMENT

Programming :: Xargs With Output Of Find

Jul 15, 2011

I'm testing some multi-plat java code and I'm getting a bit frustrated with the Linux tests. I need to run the command:
Code:
$ java -jar /home/developer/TCO/TabletComicOptimizer.jar <file> <args[]>
against all the files that match a specific criteria. I've tried various find syntax and I can't seem to get it right.

Normally I would just create a bash script and populate the results of find into an array and then just enumerate the collection but in this specific case I want to demonstrate this operation at the bash terminal.

I've tried things like:
Code:
~/TCO $ find . -type f -iname "*.cb[rz]" | xargs java -jar TabletComicOptimizer.jar {} 1200x1800 ;
Thinking that the {} is the substitution for each file returned by find but it's not working. How do I execute my java program against each result in the find operation?

View 6 Replies View Related

Software :: Find Xargs Shred Seems Really Slow

Nov 18, 2010

What am I doing wrong here ? Shredding a directory with files is incredibly slow. If I create a file of similar size it is around 1000 times faster. Filesystem is ext4, OS is Slack current. Looking at top it shows shred's status as 'D' which, according to the man page, means uninterruptible sleep ! Also /usr/bin/time shows around 10 minutes but that time was printed on stdout approx. 7 minutes before the command prompt reappeared !

Code:
[virgil@thunderbird2:~/q] $ du -sh
336M.
[virgil@thunderbird2:~/q] $ find . -type d | wc
160 160 12038
[virgil@thunderbird2:~/q] $ find . -type f | wc
6721 6721 687549
[virgil@thunderbird2:~/q] $ /usr/bin/time find . -type f -print0 | xargs -0 -r shred -zu
0.00user 0.00system 10:11.76elapsed 0%CPU (0avgtext+0avgdata 3616maxresident)k
0inputs+0outputs (0major+285minor)pagefaults 0swaps
[virgil@thunderbird2:~]

[virgil@thunderbird2:~] $ dd if=/dev/urandom of=qwerty bs=336M count=1
1+0 records in
1+0 records out
352321536 bytes (352 MB) copied, 51.6693 s, 6.8 MB/s
[virgil@thunderbird2:~]
[virgil@thunderbird2:~] $ ls -l qwerty
-rw-r--r-- 1 virgil virgil 352321536 2010-11-18 15:13 qwerty
[virgil@thunderbird2:~]
[virgil@thunderbird2:~] $ /usr/bin/time shred -zu qwerty
0.92user 0.78system 0:16.94elapsed 10%CPU (0avgtext+0avgdata 2912maxresident)k
0inputs+2752528outputs (0major+235minor)pagefaults 0swaps

View 3 Replies View Related

Programming :: One-liner With && And || Didn't Work

Feb 9, 2011

I recently noticed some of my one-liners with && and || didn't work as I expected so I googled for "bash && || pitfalls" and found this page [URL] It's probably my fault, but I still don't understand why it wouldn't work as I want it..... I don't even have the code anymore that wasn't working properly because I rewrote it using if ; then ; command ; fi

View 4 Replies View Related

Programming :: Sed One-liner: Search Text In File And Replace It - If Not Present Insert It?

Oct 16, 2010

As indicated in the subject, I want to search a text. If the text is present I want to replace it. But if the text is not present, I want to insert it after first line and before last line.

Searched text is:CleanCache "*";

Where * can be anything.

Example: CleanCache "false"; -> CleanCache "true";

If CleanCache "false"; is not present, only insert CleanCache "true"; after first line and before last line.

View 8 Replies View Related

Ubuntu :: Restore Backup Server - Where Is The Location Backup Snapshots Or Files Are Saving

May 10, 2011

I install and tested Restore EE Backup server on a test PC with basic configuration and its working fine.

[URL]

The issue i have is where is the location these backup snapshots or files are saving? I want to add a separate Storage to save the backup?

View 1 Replies View Related

Software :: Backup A Few Servers And A Bunch Of Desktops Onto One Backup Server?

May 10, 2010

Does anyone know of any decent enterprise level backup solutions for Linux? I need to backup a few servers and a bunch of desktops onto one backup server. Using rsync/tar.gz won't cut it. I need like bi-monthly full HDD backups, and things such as that, with a nice GUI interface to add/remove systems from the backup list. I need basically something similar to CommVault or Veritas. Veritas I've used before but it has its issues, such as leaving 30GB cache files. CommVault, I have no idea how much it is, and if it supports backing up to a hard drive rather than tape.

View 7 Replies View Related

Server :: Server Configuration For Small Office Server, Which Smtp, Pop Imap Server And Backup?

Apr 2, 2010

I have installed a linux server in my office to run 16 machines. Its main use will be a internal mail server but will be also running websites.

I have installed Ubuntu 9.10 server x64 and have got apache running.

I am looking for the simplest more robust solution for smtp, pop3 and imap. I have only ever used qmail before and found it a pain to configure and its getting old so I though I should probably try something new. I have not much experience with running pop3 or imap on linux so would love a suggestion on that.

View 4 Replies View Related

General :: Expanding Globs In Xargs?

Jun 29, 2011

I have a directory like this:
mkdir test
cd test
touch file{0,1}.txt otherfile{0,1}.txt stuff{0,1}.txt

I want to run some command such as ls on certain types of files in the directory and have the * (glob) expand to all possibilities for the filename.

echo 'file otherfile' | tr ' ' '
' | xargs -I % ls %*.txt

This command does not expand the glob and tries to look for the literal 'file*.txt'

How do I write a similar command that expands the globs? (I want to use xargs so the command can be run in parallel)

View 1 Replies View Related

Programming :: Using AWK Within Bash Command Via Xargs

Mar 24, 2011

I often want to extract some info using awk from a variable/filename while running other things using xargs and sh. Below is an example:
Code: ls -1 *.txt | xargs -i sh -c 'NEW=`echo $0 | awk -F'_' '{print $1}'`; echo $NEW' {}

In the above case I would like to grab just the first field from a filename (delimited by '_') from within an sh command. This is a simplified example, where normally I would be doing some further data processing with the sh command(s).

The error message that I get is:
Code: }`; echo $NEW: -c: line 0: unexpected EOF while looking for matching ``'
}`; echo $NEW: -c: line 1: syntax error: unexpected end of file.
I haven't been able to figure out how to escape the awk command properly.

View 1 Replies View Related

Ubuntu :: Find A Way To Backup Files To Cdr/dvdr?

Jan 17, 2010

I'm trying to find a way to backup my files to cdr/dvdr. I'd like to put a blank disk in when I finish using the machine, have it backup anything new, up to the size of the media and stop. I can put in new media the next day and I'd like it to continue from where it left off. It would be best if the backups are readable by any machine and I could extract specific files if a problem should arise. Any suggestions? Tar won't let me specify a final archive size and wants to do all the volumes in the backup at the same time.

View 9 Replies View Related

General :: Find Location Of USB Device For Backup?

Jan 20, 2011

I am using Cron for nightly backups to a usb device. I was just wondering in my script for the backup, how do I find the location of my usb device.

View 2 Replies View Related

Server :: Sync File Server Data Into Backup Server Machine By Command- Rsync -avu?

Jun 21, 2011

iam trying to sync file server data into backup server machine by command- rsync -avu path/of/data ipaddress-of-backup-server:/path/where/to/save after running it ask for root password and manually it is successful.but i want to make it automatic.for that i also tried cronjob and also generated authentication key but iam not successful in login automatically..anybody know how to authenticate root to login for storing data in backup server.

View 14 Replies View Related

Ubuntu :: Recover From Backup - Can't Find HD (wrong UUID)

Aug 31, 2010

I rsync the filesystem where I have my server to another HD. Now, when I try to boot I'm dropped at initramfs with an error. It looks like it's still looking for the root in the previous HD even tough I already changed /etc/fstab. It says it can't find the device with a certain UUID, and that UUID is from the previous HD.

Here's the full details: I'm running Ubuntu server 10.04 It has 2 hard drives. Every night it backups one to another with the command

Code:
rsync --archive --one-file-system --hard-links --numeric-ids --delete

I moved the HD where I have the backup to another machine and rsynced them with the same command I then changed /etc/fstab in the new machine. I also installed Grub on it When I boot in the new machine I get a error about not finding root. It says that a device is not present. It says the UUID of the device is looking for, and it's the UUID of the first HD.

I thought I only had to change /et/fstab but seems I am wrong.

View 5 Replies View Related

General :: Find The Failed Position Of CD While Taking Backup?

Aug 7, 2010

I am working in ubuntu 9.x (linux karmic kernal) .I have restored the content from CD to hard disk. In the mid way of this process, it was failed. I would like to know this below thiongs,

1) which position it got failed ?

2)Any offset option is there in linux to point the particular CD position ?

View 1 Replies View Related

General :: Copy Files Using Xargs From A Folder To Another?

Jun 10, 2009

I'm trying to copy a list of files except the files which has ".log" in the filename to another folder.I can run it correctly when I am located in the Source folder, but not when I am in any other location.cd /home/me/Sourcels /home/me/Source -1|grep -v "^.*log$" |xargs -n 1 -iHERE cp -r HERE /home/me/DestinationHow can I indicate both Source and Destination Folder?

View 2 Replies View Related

Fedora :: Using Xargs With Yum (Removing List Of Software)

Jan 23, 2010

I used the command shown below to remove a list of software using yum. It worked, but is there a way of doing this without using the -y option? I would like to review the results before the transaction takes place. I would like to use the same method for installing additional software after a clean install.
cat filename | xargs yum -y remove

View 8 Replies View Related

General :: Xargs CD Not Working (Echo Some Directory)

Mar 18, 2010

Please explain why
Code:
echo some_directory | xargs cd
is not working.
Code:
echo some_directory | xargs ls
is working as expected.

View 14 Replies View Related

General :: Xargs - Inserting Picture Into Group

Jun 17, 2011

I want to insert a picture into a group of pictures (I memorized their names in a text file) resulting a new group of picture (which I also memorized their name in another text file), but I have a problem doing that. I want to write something like that:

$> cat file1 | cat file2 | xargs composite -blend 30 text.jpg line_file1 line_file2
where
file1 is:
frame1.jpg
frame2.jpg
frame3.jpg
....

and file2 is:
new_frame1.jpg
new_frame2.jpg
new_frame3.jpg
...

View 4 Replies View Related

Programming :: Basename With Command Substitutions And Xargs

Jun 17, 2011

I get this behavior on Slackware 13.37, which includes BASH 4.1.010. Yes, BASH is my shell. I have a file called a.flac and I'm in the directory that contains it.

The output of the ls command is expected:
Code:
ls *.flac
gives:
Code:
a.flac

Removing the extension with basename works as expected:
Code:
basename a.flac .flac
gives:
Code:
a

Putting the above command in a variable substitution works as expected:
Code:
echo `basename a.flac .flac`
gives:
Code:
a

Using xargs with ls and a variable substitution works as expected:
Code:
ls *.flac | xargs -i echo `echo {}`
gives:
Code:
a.flac

However, when I try to add the basename command to the above command, it stops working.
Code:
ls *.flac | xargs -i echo `basename {} .flac`
gives:
Code:
a.flac

Whereas the result I expect is:
Code:
a
Why is it not working, and how do I make it work?

View 3 Replies View Related

General :: Xargs And Unzip All Files To Specific Directory?

Jun 22, 2009

I'm trying to find all zip files timestamped from the past 7 days, then unzip them into a different director.I tried the following, but it only unzipped one of three files that meet the 7 day criteria. What am I missing?Code:find /home/user/public_html/zip_files/ -iname "*.zip" -mtime -7 -print0 | xargs -n10 unzip -LL -o -d /home/user/public_html/another_directory/

View 1 Replies View Related

General :: Traverse The File System And Rename (xargs Or Sed)?

May 15, 2011

I need your inputs on performing some operations:-

a. Traverse from top Level directory, find all the directories

b. Rename all these directories to <original name>.dir

c. Once the renaming is done - search from top level and retain only those directories which has .txt content in them.

d. Delete rest all.....

Can i use xargs here to perform operation a and b , or will sed will be useful.

View 14 Replies View Related

General :: Xargs - How Some Command Receive Input From Both Sides

Mar 9, 2010

I would like to ask the following:
1) ls -l |grep test -> this will grep every "ls -l" output line
2) ls -1 |xargs grep test -> this will grep every single file with test
3) ls -1 |xargs echo -> this will echo directory list
4) ls -1 |echo -> this does nothing!!!

My question is: how some command can receive input from "both sides" (grep can grep whole output or every single file - xargs, the same is for i.e. wc command). 4) echo does nothing (it's a single echo command).

View 1 Replies View Related

Programming :: Using Sed With Variable Created Using Xargs / Unterminated Error

Jan 12, 2009

I have an awk program that finds all files of a specific filename and deletes them from selected subdirectories. There is logic in the awk to avoid certain subdirectories, and this is initialized via a parameter in the beginning statement of the awk. The parameter should have all of the subdirectory names at the top level. This varies from time to time, so I cannot hard-code the value.I'm having a problem initializing the awk parameter using sed. I'm setting a variable (named subdir) using an "ls" command piped to "xargs". I'm then trying to substitute that value into the awk using the sed command.

View 3 Replies View Related

Server :: Way To Backup A Web Server With One Hard Drive Running Live?

Mar 13, 2011

I currently have a centos 4.4 I believe running with a 250GB hard drive. I want to make an image of that hard drive. I have tried removing the drive and connecting it to my windows pc using an adapter that would allow my windows machine run the hard drive as it was a regular external hard drive. Of course windows doesn't reconize that drive since it is linux partitioned. I am thinking that I need to have the hard drive inthe box I am wanting to copy and put in a blank drive in the box that I want to copy to. And boot from a live CD and use cat or dd to copy it. I have seen the commands before bust I am thinking this is the only way. Basically I am wanting to have a duplicate of the drive and build a whole new server that is already all setup.I will just change the host name and assign it another Public facing UP. Is this correct? Oh, and the new server will have different hardware. Might even be AMD or intel different from source or destination.

View 12 Replies View Related

Server :: Backup Live System - Home Server

Sep 11, 2009

I'd like to know what solutions do you, people, use to backup a live system that acts as a small home mail/file/irc/web server and some other purposes. For example, right now, to backup the mail, I have to stop fetchmail, kill vixie-cron to avoid any problem and then do the backup. Then restart vixie-cron.I wonder if there's any solution that will leave me do the backup without all this hassle.

View 3 Replies View Related

Server :: Red Hat 6.1 Server Backup On WinXP Client?

Sep 6, 2010

My office uses a local Linux server running Red Hat 6.1 for an ancient text-based accounting program. The client computers (about 5 or so) run WinXP pro and use Tinyterm emulator to log in to the server. One of the client computers (we'll call it client1) had a user in Windows configured to do scheduled backups of the Linux server. The office worker for client1 was instructed to log in to xp as the backup user and leave the pc on all night and it would backup the linux server, then it would copy that backup to an external hard drive, attached to client1.

The c: hard drive on client1 died and no backups were available. I have restored the computer with a fresh xp install, but I have no idea what method was used to back the server up. I'm sure samba was used but I cannot find any documentation or instructions left behind by whoever set the system up. I have the ip address of the server and have restored tinyterm to be able to log in from client1. I also have access to the command line on the server. I just need help with being able to back the linux server up from a windows xp client.

View 8 Replies View Related

General :: "find" Command In Backup/zip Script?

Feb 13, 2011

I am fairly new to scripting and I am trying to write a script that finds and zips a file named file1.xml from multiple sub-directories. So basically I want to find them and zip them all together. The disk directory structure is as follows:

/mnt/data/user_name1/db/file1.xml
/mnt/data/user_name2/db/file1.xml
(etc, etc where user_name varies)

This is what I have so far, but I keep getting an error relating to the -name command.

filename=`date +%d%m%Y-%H:%M`
find /mnt/data/ -name file1.xml -maxdepth 2 -type d | zip -rp $filename.zip -@

I keep getting the following error but don't know how to fix it. Is what I am trying to do even possible?find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).

View 4 Replies View Related

Server :: How To Take Os Backup

Jan 14, 2011

ORACLE 10.2.0.1.0 /REDHAT 5.1 - Enterprise linux 2.6.18

1. i would like to take os backup.

2.i would like to take os backup and database backup.

View 3 Replies View Related

Server :: Backup Server - With RAID1 - 14

Mar 6, 2011

I am a college student (compSci) that moves around a lot with a laptop. I back it up often, but I dont want a simple usb hd that can be stolen from my dorm and/or damaged (its already been damaged). I am making a file server with RAID 1 that will sit at my parents house for safer backups. I just need a few pointers, I have never experimented with RAID before.

Software: Fedora 14 - Software RAID 1. I will only have ssh running on a port other than 22, behind a router, with keyed entry only so I can remotely backup my stuff.

Hardware: A new(ish) P4 mobo with two (2TB) hd's (for RAID 1) and one small hd for the OS.

My questions:
1) Should I have the OS installed on a separate drive or on the two RAID drives? I am using software RAID, not hardware, so I assume I need two external drives for the RAID.

2) Should I be using more then two hd's for a RAID 1 array?

3) How can I encrypt the RAID drives? As I said before, I have no experience with RAID.

4) If the OS drive fails, can I just grab a new hd and install Fedora on it to get the data off my RAID array? Or do I need to image the Fedora drive every so often?

5) If one of the RAID drives fail, is there some sort of daemon that can tell me? I will not be at my house physically, so I will not be able to hear scratching platters :P. Also, because the size of a single disk in the array is 2 TB, can I just go out and get any kind of 2 TB drive to replace the failed one?

6) If the MoBo fails, can I just pop in a new one (of any kind) and continue using my same array?

View 1 Replies View Related







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