1

I have a sh script to ask something that the user has to press the button "yes" or "no".

I want to show it, when the user try to shutdown ubuntu. If the answer is "yes" the process go on and will shutdown the computer but if the answer is "no" the computer won't shutdown.

I don't know where i have to put the script to do that.

My sh script:

if zenity --question --title "Have you do the homework?" --text "homework"; then echo "yes"; else echo "no"; fi

echo "return value was $?"

1 Answer 1

0

You can run scripts on shutdown by placing them on /etc/rc6.d/. Add shutdown -c at the beginning of your script and check the answer, retrigger the shutdown if the answer is "yes".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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