- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- archive script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 04:47 AM
01-24-2006 04:47 AM
ls -l
postgresql-2006-01-15_000000.log postgresql-2006-01-22_000000.log
postgresql-2006-01-16_000000.log postgresql-2006-01-23_000000.log
postgresql-2006-01-17_000000.log postgresql-2006-01-24_000000.log
find /var/log/pgsql/* -type f -mtime 0 > /tmp/today_files.txt
for a in `find /var/log/pgsql/* -type f -mtime +7`;
do
IS_TODAY=`grep -c $a /tmp/today_files.txt`
if [ "$IS_TODAY" = "1" ]; then
echo "skipping $a"
else
echo "zipping $a"
gzip $a
fi
done
INstead of doign it for all files, I just need to be able to do it to the *.logs. I don't want to keep re-archiving all files.
Also, I would like all files for a single week zipped or tarred into a common file so that we can use logrotate to handle management of these weekly archives for the rotations.
Any help will be greatly appreciated and points will be assigned.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:05 AM
01-24-2006 05:05 AM
Re: archive script
> /tmp/filelist.txt
find /var/log/pgsql/* -type f -mtime 0 > /tmp/today_files.txt
for a in `find /var/log/pgsql/* -type f -mtime +7`;
do
IS_TODAY=`grep -c $a /tmp/today_files.txt`
if [ "$IS_TODAY" = "1" ]; then
echo "skipping $a"
else
echo $a >> /tmp/filelist.txt
fi
done
tar zcvf files.tgz -T /tmp/filelist.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:10 AM
01-24-2006 05:10 AM
Re: archive script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:22 AM
01-24-2006 05:22 AM
Re: archive script
find "/var/log/pgsql/*.log"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:23 AM
01-24-2006 05:23 AM
Re: archive script
find /var/log/pgsql/ -type f -name "*.log"
I don't know what I was thinking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:31 AM
01-24-2006 05:31 AM
Re: archive script
You can also use:
find /var/log/pgsql -name "*.log" -mtime +1 -mtime -7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:49 AM
01-24-2006 05:49 AM
Re: archive script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 08:04 AM
01-24-2006 08:04 AM