Last active
January 8, 2024 19:02
-
-
Save akarca/606586955fe3796a041c1460133070e4 to your computer and use it in GitHub Desktop.
Kill CMFSyncAgent and sharingd processes if they demand high cpu
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
#!/bin/bash | |
# | |
# Sometimes my mac's fans run loud because CMFSyncAgent and sharingd processes are consuming high amount of CPU. | |
# This script watches the processes and kills them. Stop this script if you want to use AirDrop | |
# Kill CMFSyncAgent if it consumes more than 70% cpu | |
# Kill sharingd if it consumes more than 30% cpu | |
# | |
while true | |
do | |
ps aux | grep CMFSyncAgent | awk '$3>70 {print $2}' | xargs kill -9 | |
ps aux | grep sharingd | awk '$3>30 {print $2}' | xargs kill -9 | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment