I wrote small script to automatically delete Chrome cache after I close it:
#!/bin/bash
while true; do
if [[ $(pgrep -l chrome) ]]; then
sleep 20
else
rm -rf ~/.cache/google-chrome/Default/Cache/*
rm -rf ~/.cache/google-chrome/Default/"Media Cache"/*
notify-send "CCD" "Cache deleted!"
break
fi
done
Now I don't want to run this script manually everytime, I want it to run in background automatically when I launch Chrome. I tried to edit Chrome quicklist with Ubuntu Tweak:
But as I expected, it didn't work. So, is there any other way to do it?
Best Answer
Just add full path to your script into
Startup Applications
to make it start automatically upon login. Open Unity Dash and add it as new command. Of course, make sure you script has executable permissions withchmod +x /path/to/script.sh
To address the issue of chrome deleting cache on startup ( which is undesirable , as mentioned in the comments), use polling with while-loop to wait for chrome to appear.