I recently updated from Linux Mint 16 Petra to Linux Mint 17 Qiana. Everything went smoothly, except for my dock Docky. For some reason, Docky decides to crash every once in a while with some error message.
Instead of fixing this error or reporting it, I decided to find the easy way out and simple set up a cronjob to restart Docky every minute (if it has crashed).
Because it took me a bit (and you might have trouble with it too), this tiny post shows you how to do that. Simply add this to your crontab to let cron run this command every minute. Open the crontab via crontab -e:
* * * * * if [ -z "$(ps aux | grep -E DocX?ky.exe)" ]; then DISPLAY=:0.0 dbus-launch docky > /tmp/docky 2>&1; fi
This command solves a few issues:
- It checks if Docky is already running by ps-ing and grep-ing for the Docky.exe process. The X? prevents the grep from showing up in the results.
- If Docky isn’t running, it sets the DISPLAY variable to the first display (:0.0 in most cases).
- It launches Docky via dbus-launch docky, because Docky requires dbus to run.
That’s all the magic. Works like a charm for me.