Unix/Linux 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 Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix or Linux Image
Sponsored Links
    #2  
Old Unix and Linux 01-03-2013
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 20 April 2015, 6:16 PM EDT
Location: Galactic Empire
Posts: 3,402
Thanks: 240
Thanked 1,216 Times in 1,142 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 Unix and Linux 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 03:58 AM..
    #4  
Old Unix and Linux 01-22-2013
MadeInGermany MadeInGermany is online now Forum Advisor  
Registered User
 
Join Date: May 2012
Last Activity: 27 April 2015, 1:29 AM EDT
Location: Simplicity
Posts: 2,353
Thanks: 162
Thanked 711 Times in 641 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 01:36 AM.