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: 9 January 2013, 3:58 AM EST
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 April 2014, 8:35 PM EDT
Location: Galactic Empire
Posts: 3,282
Thanks: 227
Thanked 1,157 Times in 1,094 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: 9 January 2013, 3:58 AM EST
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 03:58 AM..
    #4  
Old 01-22-2013
MadeInGermany MadeInGermany is offline Forum Advisor  
Registered User
 
Join Date: May 2012
Last Activity: 16 April 2014, 4:46 PM EDT
Posts: 1,596
Thanks: 90
Thanked 452 Times in 409 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 08: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 01:31 PM
Bdf output indrajit_renu Shell Programming and Scripting 5 10-18-2010 07:45 AM
bdf question zedex UNIX for Advanced & Expert Users 4 02-09-2009 01:50 PM
df and bdf discrepencies sam_pointer HP-UX 2 10-29-2001 09:58 AM
BDF test for > 90% svp4444 UNIX for Dummies Questions & Answers 6 09-05-2001 11:49 AM



All times are GMT -4. The time now is 10:03 PM.