• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Automatic update by Email on Hard Disk percentage full
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic update by Email on Hard Disk percentage full


  • Subject: Re: Automatic update by Email on Hard Disk percentage full
  • From: Eric Taylor <email@hidden>
  • Date: Wed, 28 Jan 2009 15:21:13 -0700

This is a start. Save it as an application with "Keep Open" checked and I think it will work.

Be aware there are probably other ways to get this to happen, including the XServe monitoring tools or crontab or what-have-you...

property lowSpaceDefault : 20 --percent
property emailAddress : missing value
property checkInterval : 5 * 60 --5 minutes
property checkTime : (current date) + checkInterval
global watchList, lowSpace

--Check all the disks in the list every checkInterval minutes
on idle
if (current date) > checkTime then
set checkTime to (current date) + checkInterval
repeat with thisDisk in watchList
tell application "Finder"
set currentDiskFreePercentage to (free space of disk thisDisk) / (capacity of disk thisDisk) * 100
set currentDiskFreePercentage to round currentDiskFreePercentage
if currentDiskFreePercentage < lowSpace then
do shell script "echo 'The drive is down to " & currentDiskFreePercentage & "% free space!' | mail -s 'WARNING: Low Space on drive " & thisDisk & "' '" & emailAddress & "'"
end if
end tell
end repeat
end if
end idle

on run
if emailAddress = missing value then
set emailAddress to text returned of (display dialog "Enter the email address to inform if space runs low:" default answer "")
end if
set lowSpace to text returned of (display dialog "Display the percentage of space left at which you wish to receive an email:" default answer lowSpaceDefault)
tell application "Finder"
set diskList to name of every disk
set watchList to choose from list diskList with prompt "Select the disk(s) you wish to watch:" default items {} with multiple selections allowed
end tell
idle
end run


On Jan 28, 2009, at 1:57 PM, John Wiedenheft wrote:

I work in an 10.5 environment where the hard disks fill up very fast (video post-production).  I'd like to find a way that each editing computer (MacPro) can email the needed people that such and such hard disk is only 20% empty.  Is there a way to do this through AppleScript?  I'd like to apply this to three computers, one running OS 10.5 Server and the other two running OS 10.5.  The MacPros running 10.5 have three HDs each that I'd like to keep track of.

--
Eric Taylor
VP Technology

email@hidden
http://www.mca-plus.com

(MCA Plus was Morgan-Cain & Associates / morgan-cain.com)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Automatic update by Email on Hard Disk percentage full (From: John Wiedenheft <email@hidden>)

  • Prev by Date: Re: How do I create a Applescript Interface for my Application
  • Next by Date: Re: Automatic update by Email on Hard Disk percentage full
  • Previous by thread: Automatic update by Email on Hard Disk percentage full
  • Next by thread: Re: Automatic update by Email on Hard Disk percentage full
  • Index(es):
    • Date
    • Thread