Skip to main content
2 of 5
added 34 characters in body

Conditional Ctrl-Alt-Del shutdown

I always shutdown my Linuxes with Ctrl-Alt-Del. Now I want that the system still shutdowns with Ctrl-Alt-Del, but only if certain CONDITION is satisfied. 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....