Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

EDIT

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
add comment

3 Answers

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
add comment

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: http://stackoverflow.com/questions/1167484/how-to-gracefully-shutdown-emacs-daemon; 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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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