Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 1 down vote accepted

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.

share|improve this answer

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:; look for /etc/gdm/PostSession/.

share|improve this answer
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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .