Skip to main content
added 88 characters in body
Source Link

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.

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.

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.

added 339 characters in body
Source Link

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.

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. (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....

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.

added 47 characters in body
Source Link
Marcus Müller
  • 52k
  • 4
  • 80
  • 123

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 (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....

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....

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. (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....

added 34 characters in body
Source Link
Loading
Source Link
Loading