New topic: 

How to get free volume space on a OS X server w/o using MBS?

<http://forums.realsoftware.com/viewtopic.php?t=41032>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        Kabe          Post subject: How to get free volume space on a OS 
X server w/o using MBS?Posted: Mon Oct 17, 2011 3:07 am                         
        
Joined: Mon Apr 09, 2007 2:49 pm
Posts: 186                For a server monitor issue I'd like to track 
available space on a server which runs OS X server.

This shouldn't be too hard to do using a custom, declare, right? While I have 
found one for Carbon, I'm stuck with the Cocoa version. Any helpful pointers?

Thanks a million

Klaus   
                             Top                Akiland          Post subject: 
Re: How to get free volume space on a OS X server w/o usingPosted: Mon Oct 17, 
2011 4:07 am                                 
Joined: Tue Jan 04, 2011 3:02 am
Posts: 348
Location: Jönköping, Sweden                Sure there is 

You could use this:
Code:Dim sh as New Shell
sh.Execute("df -h | grep "+chr(34)+"/$"+chr(34))
MsgBox sh.Result
sh.close


This will return stats for your boot volume "/".
If you want stats for all mounted volumes just execute df -h instead.

You'll have to parse the result you'll get     
_________________
Bixue Kommunikation
Dev. iMac 27" (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.7
REAL.Studio Web Edition  
                             Top                 pony          Post subject: 
Re: How to get free volume space on a OS X server w/o using Posted: Mon Oct 17, 
2011 7:36 am                                 
Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1000
Location: DFW area, Texas, USA                You could also use an AppleScript.
This will return how many GB is free on the startup disk
Code:tell application "Finder" to set free_bytes to free space of startup disk 
return (free_bytes / 1024 / 1024 / 1024)

This will return how many GB is free on the disk "Time Machine Backups"
Code:tell application "Finder" to set free_bytes to free space of disk "Time 
Machine Backups"
return (free_bytes / 1024 / 1024 / 1024)      
_________________
Fly like a mouse, run like a cushion, be the small bookcase.
http://www.wish-sandwich.com  
                             Top                jranieri          Post subject: 
Re: How to get free volume space on a OS X server w/o using Posted: Mon Oct 17, 
2011 8:10 am                         
Joined: Fri Jan 28, 2011 5:24 pm
Posts: 52                Kabe wrote:For a server monitor issue I'd like to 
track available space on a server which runs OS X server.

This shouldn't be too hard to do using a custom, declare, right? While I have 
found one for Carbon, I'm stuck with the Cocoa version. Any helpful pointers?

It really depends on what the declare is, but it's likely it will just work 
under Cocoa.      
_________________
Joe Ranieri
Mac Frameworks & Compiler Engineer
REAL Software, Inc.  
                             Top                 pony          Post subject: 
Re: How to get free volume space on a OS X server w/o using Posted: Mon Oct 17, 
2011 11:04 am                                 
Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1000
Location: DFW area, Texas, USA                I'm not sure in what context this 
monitoring is taking place. Is it taking place inside an application on the 
server that functions other tasks, and you just want to monitor disk space 
whilst your application is running, or is its sole purpose to monitor disk 
space?

If your application is to solely monitor server disk space it may be a wasted 
cause.
If the Mac is a 'real' server, i.e. running a server version of the OS, then 
take a look at the command line utility diskspacemonitor
It is a configurable, and cron-activated command line utility that is normally 
found in /usr/sbin/diskspacemonitor . You can execute your own scripts when 
thresholds are met, for example sending an email.

The man pages have much more info.
Quote:diskspacemonitor(8)   BSD System Manager's Manual  diskspacemonitor(8)

NAME
   diskspacemonitor -- Mac OS X Server disk space monitoring facility

SYNOPSIS
   diskspacemonitor [on | off | status | check]

DESCRIPTION
   diskspacemonitor is a fully configurable, launchd activated facility to 
periodically monitor the amount
   of free space on disks and take pre-configured actions when thresholds are 
exceeded.

   In typical usage, diskspacemonitor is enabled by running "sudo 
diskspacemonitor on".

OPTIONS
   on - enables the mechanism by adding a launchd task

   off - disables the mechanism by deleting the unloading and disabling the 
launchd task

   status - shows whether the mechanism is enabled, and the monitor interval, 
if it is (value returned is
   in minutes).

   check - performs the configured checking operations. This is normally 
invoked by the launchd task at
   the specified monitor interval.

CONFIGURATION
   diskspacemonitor is driven by config file:

   /etc/diskspacemonitor/diskspacemonitor.conf

   diskspacemonitor executes alert and recovery scripts in:

   /etc/diskspacemonitor/action/

   Two pre-defined scripts are provided:

   /etc/diskspacemonitor/action/alert, to alert the administrator that a 
warning threshold is exceeded,
   and

   /etc/diskspacemonitor/action/recover, to recover disk space by compressing, 
rolling, and deleting log
   files.

   These scripts are also driven by config files:

   /etc/diskspacemonitor/alert.conf
   /etc/diskspacemonitor/recover.conf

   Administrators may add their own scripts:

   /etc/diskspacemonitor/action/alert.local
   /etc/diskspacemonitor/action/recover.local
   These will be invoked at the respective disk space thresholds before the 
standard scripts are invoked.

FILES & FOLDERS
   /usr/sbin/diskspacemonitor
   /etc/diskspacemonitor/diskspacemonitor.conf
   /etc/diskspacemonitor/recover.conf
   /etc/diskspacemonitor/alert.conf
   /etc/diskspacemonitor/action/recover
   /etc/diskspacemonitor/action/alert
   /var/log/diskspacemonitor.log
   /System/Library/LaunchDaemons/com.apple.diskspacemonitor.plist

Mac OS X Server       16 Jun 2002      Mac OS X Server
      
_________________
Fly like a mouse, run like a cushion, be the small bookcase.
http://www.wish-sandwich.com  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to