Skip to content

Instantly share code, notes, and snippets.

@zxt-tzx
Created December 27, 2022 14:42
Show Gist options
  • Save zxt-tzx/db624b428de1449032b0fdd34c9cc597 to your computer and use it in GitHub Desktop.
Save zxt-tzx/db624b428de1449032b0fdd34c9cc597 to your computer and use it in GitHub Desktop.
prioritise iCloud syncing processes
#!/bin/sh
bird_pid=$(pgrep bird)
cloudd_pid=$(pgrep cloudd)
nsurlsessiond=$(pgrep nsurlsessiond)
# check all the values are not empty
# refactor to not use [[ ]] and use [ ] instead
if [[ -z "$bird_pid" || -z "$cloudd_pid" || -z "$nsurlsessiond" ]]; then
echo "bird, cloudd or nsurlsessiond is not running"
exit 1
fi
for pid in $bird_pid; do
renice -n -10 -p "$pid"
done
for pid in $cloudd_pid; do
renice -n -10 -p "$pid"
done
for pid in $nsurlsessiond; do
renice -n -10 -p "$pid"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment