I always shutdown my Linuxes with Ctrl-Alt-Del from a virtual console (outside any window mangager - KDE).
Now I want that the system still shutdowns with Ctrl-Alt-Del, but only if certain CONDITION is satisfied. (That condition is the existence of a file.)
Something like this:
#!/bin/bash
if [[ ! CONDITION ]]; then
echo
echo " *************************"
echo " *************************"
echo " ** **"
echo " ** WRONG CONDITION **"
echo " ** **"
echo " *************************"
echo " *************************"
echo
else
sudo shutdown -h now
fi
I guess that I can do a service/target thing, but I have failed miserably....
EDIT: I do not need this to be through anything special, in particular, not with a service/target. This was just the thing I tried. I just want to Ctrl-Alt-Del from a virtual console after logout, and the system to execute the script above instead of the system poweroff. Maybe by recreating a symlink pointing to my script instead of poweroff, or whatever.
Ctrl-Alt-Delas always, but only if CONDITION is satisfied. The actual CONDITION is not relevant.