I want to check 10+ local Git repositories if they have any unpushed commit, before shutdown.

(I always forgot to push them, so later, the next morning I came office and back home again)

I think maybe the shutdown process can check some conditions to meet, if any condition is not met, then give the user the choice to continue to shutdown or just cancel.

Then, I can write something to hook the shutdown to check my Git repository to push.


I have changed the title from Ubuntu shutdown hook to Compiz shutdown hook. I want to hook to the small lovely shutdown button, rather then click another ugly shortcut icon on the desktop.

  • Why does this need to be compiz? Why not just put a script in /etc/rc0.d? – Michael Mior May 15 '11 at 19:17

You could go the easy way and write a shutdown-script, which does this checking for you. Instead of clicking shutdown, you click on this script.

Unfortunately, I haven't worked by now with GIT, so you I can't give you any pointers on how this could work.


The proper way to hook this in would be to run a script when you log out of gdm. Unfortunately, there does not seem to be a straightforward way to configure this on a per-user basis. This question contains some ideas how to set this up, though: https://stackoverflow.com/questions/1167484/how-to-gracefully-shutdown-emacs-daemon; look for /etc/gdm/PostSession/.

  • I have tried a test script #!/bin/sh \n exit 1, however, it couldn't cancel the shutdown process. So, the post session script doesn't work for me. – Xiè Jìléi Jan 11 '11 at 1:02

I think what you want can be solved with the Sentinella app, you can do program it to monitor a script launched by you, and once this script the app shutdowns the system for you. You will need a little bit of bash, but otherwise this solves your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.