LinuxQuestions.org
Visit Jeremy's Blog.
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 06-08-2004, 04:11 AM   #1
onewhoknows
Member
 
Registered: May 2004
Posts: 30

Rep: Reputation: 15
scripting a find, cp and bzip2 then scp process


Every day I need to find files generated for the previous day in three different directories, copy them over to a staging directory, then bzip2 them.

Afterwards, I scp all those bzip2'ed files onto another machine.

I do this process at 5 minutes past midnight every weekday and it's getting tedious doing it for 21 machines. I'm very new to scripting (read: only looked at other people's scripts), so any help concerning how I'd go about scripting all of this would be very helpful.

I know that after it's done, adding it to the crontab file will be a breeze.

Here's basically the process that I use:

Quote:
[achi@air3 home]# ssh om01@om01

om01@om01's password:

[om01@om01 om01]$ find audit/*06-07.log -exec cp {} /home/om01/staging/ \;
[om01@om01 om01]$ find state/*060704.log -exec cp {} /home/om01/staging/ \;
[om01@om01 om01]$ find *0607* -exec cp {} /home/om01/staging/ \;
[om01@om01 om01]$ find *06-07* -exec cp {} /home/om01/staging/ \;
[om01@om01 om01]$ cp om01/state/*.ser /home/om01/staging
[om01@om01 om01]$ cp om01/state/positions /home/te07/staging
[om01@om01 om01]$ cd om01/staging
[om01@om01 staging]$ pwd
/home/om01/staging
[om01@om01 staging]$ bzip2 *.log
[om01@om01 staging]$scp *.bz2 chronos@beast:/u1/logfiles/2004/06-jun/7/om01/
I tried using mtime like so:
[om01@om01 home]$ find om01/audit -name *.log -mtime +1 -exec cp {} /home/om01/staging/ \;

I can't figure out what I'm doing wrong because it doesn't give me the right dates. I tried "-mtime -1" and it gives me two days behind.

Anyways, anyone who read this far, thanks for bearing with me! I appreciate any help

Last edited by onewhoknows; 06-08-2004 at 05:55 AM.
 
Old 06-08-2004, 04:20 AM   #2
Qucho
Member
 
Registered: Mar 2004
Location: Colorado, US
Distribution: Debian "Sarge"
Posts: 228

Rep: Reputation: 30
I dont know how to make the script that you need but here is a nice tutorial:
http://www.freeos.com/guides/lsst/index.html

Hope it helps.
 
Old 06-08-2004, 07:05 AM   #3
onewhoknows
Member
 
Registered: May 2004
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Qucho
I dont know how to make the script that you need but here is a nice tutorial:
http://www.freeos.com/guides/lsst/index.html

Hope it helps.
Thanks, I'll read over that
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-29-2008 12:41 AM
Help with some scripting to find and sort? thebudbottle Linux - General 3 03-21-2005 06:20 AM
Shell scripting to find length of filenames ridertech Linux - Newbie 2 08-25-2004 01:07 PM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 02:19 PM
Where to find about shell scripting in the internet green_one Linux - Software 3 04-23-2004 06:33 PM

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

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