|
|
|
|
|
|
| Author |
Message |
mabus *nix forums beginner
Joined: 30 Jun 2005
Posts: 3
|
Posted: Thu Jun 30, 2005 10:46 am Post subject:
help with a little script
|
|
|
Hi there,
i need someone to help me with a little script i have to run in my
machine:
each day a process generates more than 5000 archives in a directory and
i need to move all the archives (1 day old) to another directory, and
make a tar file with them; if the archives have a name like this:
*YYYYMMDD*, how do i create a script that moves them and make a tar
with this format *YYYYMMDD*.tar ???
tks
Mabus |
|
| Back to top |
|
 |
J. Lievisse Adriaanse *nix forums beginner
Joined: 25 Jun 2005
Posts: 6
|
Posted: Thu Jun 30, 2005 10:53 am Post subject:
Re: help with a little script
|
|
|
What kind of script do you want? Perl or SH or what ?
Jasper
On 30 Jun 2005 05:46:08 -0700
"mabus" <mateo.monsalve@gmail.com> wrote:
| Quote: | Hi there,
i need someone to help me with a little script i have to run in my
machine:
each day a process generates more than 5000 archives in a directory and
i need to move all the archives (1 day old) to another directory, and
make a tar file with them; if the archives have a name like this:
*YYYYMMDD*, how do i create a script that moves them and make a tar
with this format *YYYYMMDD*.tar ???
tks
Mabus
|
|
|
| Back to top |
|
 |
mabus *nix forums beginner
Joined: 30 Jun 2005
Posts: 3
|
Posted: Thu Jun 30, 2005 11:18 am Post subject:
Re: help with a little script
|
|
|
|
i need to use a sh script |
|
| Back to top |
|
 |
J. Lievisse Adriaanse *nix forums beginner
Joined: 25 Jun 2005
Posts: 6
|
Posted: Fri Jul 01, 2005 8:01 am Post subject:
Re: help with a little script
|
|
|
Ok, this one should work. I have tested it on my OpenBSD laptop, but you probaly have to adjust the variables (especially date, since it differs per OS). You have to make sure that the $DESTDIR has been created before running the script.
#!/bin/sh
#
# J. Lievisse Adriaanse, 2005, BSD-license.
# Purpose: A quick backup script for Mabus.
#
TEMPDIR=/tmp/archives
DESTDIR=/var/backup/tar/
ORIGDIR=/home/mabus/archives/
FNAME='/bin/date +%Y-%m-%d'
mkdir $TEMPDIR
cd $ORIGDIR
for i in `/bin/ls`; do
mv $i $TEMPDIR
done
cd $TEMPDIR
tar -cf `$FNAME`.tar *
mv `$FNAME`.tar $DESTDIR
rm -fr $TEMPDIR
Cheers,
Jasper
On 30 Jun 2005 06:18:57 -0700
"mabus" <mateo.monsalve@gmail.com> wrote:
| Quote: | i need to use a sh script
|
|
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 6:14 am | All times are GMT
|
|
Bankruptcy | Loans and Credit Cards | Debt Consolidation | Loans | Credit Reports
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|