Null a file when /var usage is at 90%


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Null a file when /var usage is at 90%
# 1  
Old 08-29-2014
Question Null a file when /var usage is at 90%

Hi Guys

Please help me with a script. I don't have any idea on scripting.

When /var usage goes to 90%, I want the file /var/log/tsm/dsmsched.log to be nulled.

The command to null is
Code:
cat /dev/null > /var/log/tsm/dsmsched.log

but how to make it happen when /var usage is at 90%

Last edited by rbatte1; 08-29-2014 at 10:22 AM.. Reason: Added CODE tags
# 2  
Old 08-29-2014
Hello newtoaixos,

We can give you basic idea, then kindly try by yourself and let us know if you face any issues, as our forum's aim is to help each person to learn.
Here are some points by which you can start your script.
  1. you can take threshould of filesystem when you want to nullify the large size log file in a variable.
  2. you can then use if else statements to check the disk space if this condition is TRUE means if threshould of Disk space crosses then you can nullify the file by the command which you have given. (Not sure if this will allow us to nullify logs as some processes needs to be stopped first then they will allow to nullify the log files.)
Please try it by your self and let us know if you have queries. Also you can always refer man if or man test for your help too.

EDIT: Also kindly use code tags for commands and codes which you are going to mention in your post, you can use the preview post option too before posting.


Thanks,
R. Singh

Last edited by RavinderSingh13; 08-29-2014 at 11:11 AM.. Reason: Requesting user to add code tags - RBATTE1 added LIST=i tags
# 3  
Old 08-29-2014
Code:
 >/var/log/tsm/dsmsched.log

does the job too...

Completing Ravinders post, the choice of how will depend what utilites you have running to monitor...
If none, then you are to write a script and use cron...
# 4  
Old 08-29-2014
Hi,

I'm guessing that you have a log that is filling /var here and that you suspect that the culprit is;

Code:
/var/log/tsm/dsmsched.log

The proper way to address this problem is to modify the configuration file;

Code:
dsm.sys

You should read the proper documentation when you are looking to correct issues with applications like TSM, you can find specific information here.

Regards

Dave

Last edited by gull04; 08-29-2014 at 11:50 AM.. Reason: Spelling
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog

I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog. tail -f /var/log/messages dblogger: msg_to_dbrow: no logtype using missing dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies

2. Shell Programming and Scripting

Csh , how to set var value into new var, in short string concatenation

i try to find way to make string concatenation in csh ( sorry this is what i have ) so i found out i can't do : set string_buff = "" foreach line("`cat $source_dir/$f`") $string_buff = string_buff $line end how can i do string concatenation? (1 Reply)
Discussion started by: umen
1 Replies

3. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

4. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

5. Solaris

Lost /var/sadm/install/contents file and /var/sadm/pkg

Hello, I recently found that my /var/sadm/install/contents, ~/admin/default, /var/spool/patch and /var/spool/pkg files were empty. This broke the pkginfo, pkgchk and other package related tools. The pkgmap no longer points to where the applications have been installed. I have replaced the... (0 Replies)
Discussion started by: ronin42
0 Replies

6. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

7. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. UNIX for Dummies Questions & Answers

var memory usage increasing

Hi all Just a couple days ago my /var/ partition was at 63% now its shot up to 83%. I checked my log file sizes and they same ok # ls -l |more total 38820 -rw-r----- 1 root root 3754 Aug 1 19:26 acpid drwxrwxrwx 2 root root 4096 Aug 24 04:11 admserv -rw------- ... (28 Replies)
Discussion started by: mcraul
28 Replies

10. Solaris

Usage of /var/tmp/ directory on Solaris 10

Hi All, I have some threaded applications. Design of the application is such that one thread will decode some data and put it in data structure, And main thread will wait for another child threads pick up the decoded data. The data will be large decoded files. Once decoded data is picked by... (1 Reply)
Discussion started by: patilmuragesh
1 Replies
Login or Register to Ask a Question