Created
October 16, 2012 14:11
-
-
Save kikaigyo/3899495 to your computer and use it in GitHub Desktop.
release inactive mem.app use $du command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--disk usage | |
(* 10.6までは5〜10秒。10.7以降は20〜25秒 *) | |
do shell script "du -sx / &> /dev/null & sleep 25 && kill $!" | |
delay 2 | |
--Finderを再起動 | |
do shell script "killall Finder" | |
--Menubarを再起動 | |
do shell script "killall SystemUIServer" | |
delay 5 | |
--Dockを再起動 | |
do shell script "killall Dock" | |
delay 6 | |
property rt : return as text | |
tell application "Growl" | |
set the allNotificationsList to ¬ | |
{"Release mem"} | |
set the enabledNotificationsList to ¬ | |
{"Release mem"} | |
register as application ¬ | |
"Release mem" all notifications allNotificationsList ¬ | |
default notifications enabledNotificationsList ¬ | |
icon of application "Release mem" | |
notify with name ¬ | |
¬ | |
"Release mem" title ¬ | |
"Memory notification" description ¬ | |
(my Status() as Unicode text) application name ¬ | |
"Release mem" icon of application "Release mem" | |
end tell | |
on Status() | |
set memoryStatus to do shell script "top -l 1 | head -10 | grep PhysMem" | |
set wiredMem to word 2 of memoryStatus | |
set activeMem to word 4 of memoryStatus | |
set inactiveMem to word 6 of memoryStatus | |
set usedMem to word 8 of memoryStatus | |
set freeMem to word 10 of memoryStatus | |
set swapusage to do shell script "sysctl vm.swapusage" | |
set theSwap to "Swap : " & word 7 of swapusage & " (" & word 4 of swapusage & ")" | |
set grepLine to do shell script "top -l 1 | head -10 | grep VM" | |
set pageins to (((round (word 7 of grepLine as number) / 4096 * 100) / 100 * 16) as text) & "M" | |
set pageouts to (((round (word 10 of grepLine as number) / 4096 * 100) / 100 * 16) as text) & "M" | |
return "空き : " & freeMem & rt & "固定 : " & wiredMem & rt & "使用 : " & activeMem & rt & "非使用 : " & inactiveMem & rt & "確保中 : " & usedMem & rt & rt & theSwap & rt & "Page Ins : " & pageins & rt & "Page Outs : " & pageouts & rt | |
end Status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment