-
-
Save jivanpal/30af7741721e597575e10f5ef8560062 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
if [ "$1" = "-s" ] || [ "$1" = "--show" ]; then | |
show=true | |
else | |
show=false | |
fi | |
if $show || [ "$1" = "-v" ] || [ "$1" = "--verbose" ]; then | |
verbose=true | |
else | |
verbose=false | |
fi | |
kill_list="" | |
for i in $(pgrep -i adobe); do | |
if $verbose; then | |
echo -n "PID $i -- " | |
ps -p "$i" -o command $($show || echo -c) | awk 'ORS=""; NR==2' | |
fi | |
ps -p "$i" -o command | awk 'NR==2' | grep -E '^/Applications/Adobe XD/Adobe XD\.app/Contents/MacOS/Adobe XD$' > /dev/null | |
if [ $? -eq 1 ] ; then | |
$verbose && echo " -- KILL" | |
kill_list="$kill_list $i" | |
else | |
$verbose && echo " -- KEEP ALIVE" | |
fi | |
done | |
if [ -z "$kill_list" ] ; then | |
$verbose && echo "Nothing to kill" | |
else | |
if $verbose; then | |
echo "KILL_LIST = $kill_list" | |
set -x | |
fi | |
$show || sudo kill -TERM $kill_list | |
fi |
So, I've tweaked what I believe is a better catch-all GREP for many Creative Cloud apps, based on standard adobe installations and naming conventions.
ps -p "$i" -o command | awk 'NR==2' | grep -E '^\/Applications\/(Adobe( (\w)+)+)( [0-9]{4})?\/Adobe( (\w)+)+( [0-9]{4})?\.app\/Contents\/MacOS\/(\1|AdobeAcrobat|After Effects)$'
This seems to work really well. The only thing I noticed is that it didn't catch CCLibrary.app
.
How can I undo the script?
I did simply rename "CCXProcess.app" to "CCXProcess-.app", and it works.
No adobecrdaemon is keeping running now.
I am using iMac.
@HarithSami The script just kills currently running processes, it doesn't make any permanent changes to the system configuration, so there is nothing to undo. If you restart Creative Cloud or just open one of the Creative Cloud apps, the daemons should be started again.
Here's a really great kill-apps
helper from sunknudsen/privacy-guides that can be added to .zshrc
:
# Kill apps that match string
function kill-apps() {
IFS=$'\n'
red=$(tput setaf 1)
normal=$(tput sgr0)
if [ -z "$1" ] || [ "$1" = "--help" ]; then
printf "%s\n" "Usage: kill-apps string"
return 0
fi
printf "%s\n" "Finding apps that match “$1”…"
sleep 1
processes=($(pgrep -afil "$1"))
if [ ${#processes[@]} -eq 0 ]; then
printf "%s\n" "No apps found"
return 0
else
printf "%s\n" "${processes[@]}"
printf "$red%s$normal" "Kill found apps (y or n)? "
read -r answer
if [ "$answer" = "y" ]; then
printf "%s\n" "Killing found apps…"
sleep 1
for process in "${processes[@]}"; do
echo $process | awk '{print $1}' | xargs sudo kill 2>&1 | grep -v "No such process"
done
printf "%s\n" "Done"
return 0
fi
fi
}
paste above script into ~/.zshrc
and then run source ~/.zshrc
. Then you can just use commands like kill-apps adobe
to kill all adobe related stuff.
So, I've tweaked what I believe is a better catch-all GREP for many Creative Cloud apps, based on standard adobe installations and naming conventions.
ps -p "$i" -o command | awk 'NR==2' | grep -E '^\/Applications\/(Adobe( (\w)+)+)( [0-9]{4})?\/Adobe( (\w)+)+( [0-9]{4})?\.app\/Contents\/MacOS\/(\1|AdobeAcrobat|After Effects)$'