Bdf in HP-UX | Unix Linux Forums | HP-UX

  Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Bdf in HP-UX

HP-UX


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-03-2013
djmental djmental is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 6 August 2014, 5:40 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Bdf in HP-UX

Hi guys, I have to make an output of several databases we've got running on our system with the command bdf. This has to be done every 3 months. I want to put it in an scriptfile and trigger it in crontab. In the output it must display the differences in diskspace between these three monts. Any idea how to do this? I'm an newbie on hp-ux
Sponsored Links
    #2  
Old 01-03-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 17 December 2014, 4:49 PM EST
Location: Galactic Empire
Posts: 3,395
Thanks: 240
Thanked 1,211 Times in 1,137 Posts
To schedule script every 3 months in crontab:

Code:
0 0 3,6,9,12 * * script

Run bdf, write to a file

Code:
bdf [filesystem] | awk 'NR>1&&NF==5' > out_$(date +%b)

Later you can read from files for each month and compute difference.
Sponsored Links
    #3  
Old 01-07-2013
djmental djmental is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 6 August 2014, 5:40 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thx!

Is there a way to calculate the differences between this? I mean with a script.

Last edited by djmental; 01-09-2013 at 04:58 AM..
    #4  
Old 01-22-2013
MadeInGermany MadeInGermany is offline Forum Advisor  
Registered User
 
Join Date: May 2012
Last Activity: 18 December 2014, 1:32 AM EST
Location: Simplicity
Posts: 2,089
Thanks: 140
Thanked 613 Times in 556 Posts
Berkeley df can break the output in two lines,
even if the output is not connected to a terminal (e.g. to a pipe).
So it's safer to have

Code:
#!/bin/ksh -p
bdf | awk 'NR>1 && NF>=5 { print $(NF-1) }' > out_$(date +%b)

A post processor script (to be run in the directory with the 3 files) can look like this:

Code:
#!/bin/ksh -p
ls -rt |
while read file
do
 read val < $file
 val=${val%%%}
 if [ -z "$preval" ]
 then
  preval=$val
 else
  delta=$(($val - $preval))
  printf "%s: %d (%+d)\n" $file $val $delta
 fi
done


Last edited by MadeInGermany; 01-22-2013 at 09:06 AM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bdf hangs pabloli150 HP-UX 7 01-14-2012 02:31 PM
Bdf output indrajit_renu Shell Programming and Scripting 5 10-18-2010 08:45 AM
bdf question zedex UNIX for Advanced & Expert Users 4 02-09-2009 02:50 PM
df and bdf discrepencies sam_pointer HP-UX 2 10-29-2001 10:58 AM
BDF test for > 90% svp4444 UNIX for Dummies Questions & Answers 6 09-05-2001 12:49 PM



All times are GMT -4. The time now is 10:24 AM.