Sponsored Content
Top Forums Shell Programming and Scripting Compressing previous log automatically Post 302711801 by kaibiganmi on Monday 8th of October 2012 03:48:12 AM
Old 10-08-2012
Compressing previous log automatically

I want to create a script that will zip the previous log.

Example.

abc.log.2012.12.02
abc.log.2012.12.01.gzip
abc.log

If today is 2012.12.03 , my current log is abc.log and my previous date is 2012.12.02, i want abc.log.2012.12.02 to compress everytime I run the script.

I can manually run compress the file
gzip abc.log.2012.12.02 but I want the log to automate every 2am in the morning.
Every 1200midnight the file is rotating and it creates a previous date, and I want this previous date file to be compress.

I now how to use the cronjob but i dont have script to do it. Please help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep a log file to filter previous dates

Hi, I have problem of filtering a log file from my perl script. #cat /data/pinpe.csv_20070731 | nawk -v FS=, '{print $1','$18','$22','$26}' | grep -w 100 | grep -w 1 | nawk '{print $4}' Below is the output: 2009-06-16 2009-01-29 2009-06-02 2008-03-05 2007-08-05 2007-09-24... (5 Replies)
Discussion started by: pinpe
5 Replies

2. Shell Programming and Scripting

Previous log and diff

Logs are created on a daily basis, the format of the log file is: servername_yymmdd. I need to check if there is a difference in the log created today with the previous one. I would appreciate help on how I can step back to the previous log and how can I test if there is a diff in the logs. ... (4 Replies)
Discussion started by: gugs
4 Replies

3. Shell Programming and Scripting

Script - How to automatically start another process when the previous process ends?

Hi all, I'm doing automation task for my team and I just started to learn unix scripting so please shed some light on how to do this: 1) I have 2 sets of datafiles - datafile A and B. These datafiles must be loaded subsequently and cannot be loaded concurrently. 2) So I loaded datafile A... (10 Replies)
Discussion started by: luna_soleil
10 Replies

4. Shell Programming and Scripting

Automatically Rerun a script based on previous execution output

Hi Experts, I have a shell script called "updatevs" that is scheduled to run at 6.00 am everyday via cronjob. The cronjob will execute this script and output to a log file. The functionality of this script is to read the database and run a set of commands. This script is generally successful... (6 Replies)
Discussion started by: forumthreads
6 Replies

5. UNIX for Dummies Questions & Answers

Compressing of log files

Hello All My first post in the forum. :) I've this huge log files of size 20GB-30 GB in my unix server. I want to analyse the log file for some error messages. But because of the enormity of the size of these files i'm not able to grep/search the pattern in the file . Also, tried to gzip the... (1 Reply)
Discussion started by: sgbhat
1 Replies

6. Shell Programming and Scripting

Reading/Compressing of log file

Hello All Posted a similar thread in some other section too. Regrets if this section is not suitable for this post. Request all the members to be tolerant as i'm a newbie here :) Coming to the topic : I've this huge log files of size 20GB-30 GB in my unix server. I want to analyse the log... (2 Replies)
Discussion started by: sgbhat
2 Replies

7. Shell Programming and Scripting

check log for previous date

Hi, i want to check the log for previous date. For getting today's log I have written the script result=tot_max_`date+%y%m%d`.log Pls can anyone help on how to get for previous date. Thanks in Advance, Neha. (5 Replies)
Discussion started by: NehaKrish
5 Replies

8. Shell Programming and Scripting

Delete log files automatically.

Here is the script I want to run to deleted log files after a certain time: touch /usr/WebSphere/AppServer/profiles/AppSrv01/apps/RSA/logs find /usr/WebSphere/AppServer/profiles/AppSrv01/apps/RSA/logs -atime +120 - exec rm -rf {}\; Exerytime I run it, it throws me the error: find: paths must... (2 Replies)
Discussion started by: lennyz04
2 Replies

9. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

10. Shell Programming and Scripting

Bash to select oldest folder in directory automatically and log process

The `bash` below uses the oldest folder in the specified directory and logs it. The goes though an analysis process and creates a log. My problem is that if there are 3 folders in the directory folder1,folder2,folder3, the bash is using folder2 for the analysis eventhough folder1 is the oldest... (0 Replies)
Discussion started by: cmccabe
0 Replies
BOS_GETLOG(8)						       AFS Command Reference						     BOS_GETLOG(8)

NAME
bos_getlog - Prints a server process's log file SYNOPSIS
bos getlog -server <machine name> -file <log file to examine> [-cell <cell name>] [-noauth] [-localauth] [-help] bos getl -s <machine name> -f <log file to examine> [-c <cell name>] [-n] [-l] [-h] DESCRIPTION
The bos getlog command displays on the standard output stream the specified log file from the machine named by the -server argument. The BOS Server fetches the log file from the /var/log/openafs directory unless an alternate pathname is provided as part of the -file argument. CAUTIONS
Log files can grow quite large, especially for the database server processes. To keep them to a manageable size, periodically either use the UNIX rm command to truncate each log file, or use the bos restart command to restart each process. It can take up to five minutes after the file is removed or process restarted for the space occupied by a log file to become available. OPTIONS
-server <machine name> Indicates the server machine from which to retrieve the log file. Identify the machine by IP address or its host name (either fully- qualified or abbreviated unambiguously). For details, see bos(8). -file <log file to examine> Names the log file to display. If a filename only is provided, the BOS Server fetches the log file from the /var/log/openafs directory; the standard values are: AuthLog The Authentication Server (kaserver) log file. BackupLog The Backup Server (buserver) log file. BosLog The BOS Server (bosserver) log file. FileLog The File Server (fileserver) log file. SalvageLog The Salvager (salvager) log file. VLLog The Volume Location (VL) Server (vlserver) log file. VolserLog The Volume Server (volserver) log file. If a pathname and filename are provided, the log file is retrieved from the indicated directory. Partial pathnames are interpreted relative to the /var/log/openafs directory. -cell <cell name> Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see bos(8). -noauth Assigns the unprivileged identity "anonymous" to the issuer. Do not combine this flag with the -localauth flag. For more details, see bos(8). -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The bos command interpreter presents the ticket to the BOS Server during mutual authentication. Do not combine this flag with the -cell or -noauth options. For more details, see bos(8). -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output is preceded by the line Fetching log file '<filename>'... The remainder of the output depends on the particular log file. EXAMPLES
The following example displays the FileLog file from the machine "fs3.abc.com": % bos getlog -server fs3.abc.com -file FileLog Fetching log file 'FileLog'... Sun Nov 8 04:00:34 1998 File server starting Sun Nov 8 04:00:39 1998 Partition /vicepa: attached 21 volumes; 0 volumes not attached Sun Nov 8 04:00:40 1998 File Server started Sun Nov 8 04:00:40 1998 Mon Nov 9 21:45:06 1998 CB: RCallBack (zero fid probe in host.c) failed for host 28cf37c0.22811 PRIVILEGE REQUIRED
The issuer must be listed in the /etc/openafs/server/UserList file on the machine named by the -server argument, or must be logged onto a server machine as the local superuser "root" if the -localauth flag is included. When a server is in restricted mode, bos getlog can only return the contents of the salvager's log. SEE ALSO
bos(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 BOS_GETLOG(8)
All times are GMT -4. The time now is 01:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy