niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » Tru64
help with a little script
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
mabus
*nix forums beginner


Joined: 30 Jun 2005
Posts: 3

PostPosted: Thu Jun 30, 2005 10:46 am    Post subject: help with a little script Reply with 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
J. Lievisse Adriaanse
*nix forums beginner


Joined: 25 Jun 2005
Posts: 6

PostPosted: Thu Jun 30, 2005 10:53 am    Post subject: Re: help with a little script Reply with quote

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

PostPosted: Thu Jun 30, 2005 11:18 am    Post subject: Re: help with a little script Reply with quote

i need to use a sh script
Back to top
J. Lievisse Adriaanse
*nix forums beginner


Joined: 25 Jun 2005
Posts: 6

PostPosted: Fri Jul 01, 2005 8:01 am    Post subject: Re: help with a little script Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 6:14 am | All times are GMT
navigation Forum index » *nix » Tru64
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts does squid 2.6 support setting cache_peer port in redirec... Victor Tsang Squid 0 Fri Jul 21, 2006 8:16 am
No new posts mail script eeb4u@hotmail.com shell 3 Fri Jul 21, 2006 5:50 am
No new posts A simple bash script JPB Suse 2 Fri Jul 21, 2006 2:19 am
No new posts Getting started in PXPerl, i.e how to run a script? Markus Hänchen Perl 5 Thu Jul 20, 2006 2:12 pm
No new posts Match pattern in ksh script lnrntx@gmail.com shell 6 Thu Jul 20, 2006 1:48 am

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
[ Time: 0.1465s ][ Queries: 16 (0.0721s) ][ GZIP on - Debug on ]