Skip to content

Instantly share code, notes, and snippets.

@zxt-tzx
zxt-tzx / kill-bird.sh
Last active February 16, 2023 08:23
shell script to kill bird (iCloud syncing)
#!/bin/sh
pid=$(ps -fe | grep 'bird' | grep -v grep | awk '{print $2}')
if [[ -n $pid ]]; then
kill $pid
else
echo "bird is not running"
fi
@zxt-tzx
zxt-tzx / sync.sh
Created December 27, 2022 14:42
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