Hello:
I have written a small applescript which requests the ip address of a unit to login to and request an df -h command, which in exchange will return the Volumes mounted and their usage percentage.
example:
spawn ssh admin@10.1.0.123 df -h
Password:
Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s3 15Gi 9.7Gi 5.0Gi 66% /
devfs 108Ki 108Ki 0Bi 100% /dev
fdesc 1.0Ki 1.0Ki 0Bi 100% /dev
map -hosts 0Bi 0Bi 0Bi 100% /net
map auto_home 0Bi 0Bi 0Bi 100% /home
/dev/disk0s2 15Gi 8.6Gi 6.3Gi 58% /Volumes/Rescue
/dev/disk0s4 26Gi 7.7Gi 18Gi 31% /Volumes/Vault
/dev/disk1s2 51Gi 33Gi 18Gi 65% /Volumes/MediaVault
I am interested in using this data to define actions…
first find “/dev/disk0s3/” and if its capacity is at 100% run a shell script
then find “/dev/disk0s2/” if it is not available run a shell script
then find “/dev/disk0s4/” if it is not available run a shell script
lastly… Alert the client what were the actions taken as an “Alert Message”.
So far… I have everything needed up to the point of obtaining the df -h command response, but I cannot figure out how to manipulate the returned data to perform further commands…
Please, if any ideas, I would really appreciate your points of view.
HT