<div dir="ltr"><div><div><div><br></div>Hello list,<br><br></div>in a desktop session it is common behaviour to have a pop up dialog<br>if the user presses CTRL+ALT+DEL.<br></div><div>If the user press cancel, the original desktop is resumed.<br></div><div><br></div><div>I like to have the same functionality on a virtual console.<br></div><div>If the user hits CTRL+ALT+DEL on /dev/tty2 I can display a dialog:<br><br>[ ] reboot<br>[ ] halt   <br>[ok] [cancel]<br><br></div><div>and if the user hits cancel the focus should switch back to the virtual console, where<br>CTRL+ALT+DEL was pressed.<br><br></div><div>I need the console in a shutdownselect.service file (and in the script)<br></div><div>where the user pressed CTRL+ALT+DEL.<br><br></div><div>I cannot figure out how to do it.<br><br></div><div>The script started from systemd gets for the tty command "not a tty"<br></div><div><br></div><div>best regards,<br><br></div><div>Martin<br><br></div><div>PS: The implemenation goes like this "shutdownselect.sh":<br></div><div><br>#!/bin/bash<br></div><div>CURR_TTY=`/usr/bin/tty`<br>case "$CURR_TTY" in <br>   /dev/tty*)     <br>            ;; <br>   *)<br></div><div>       echo "err: $CURR_TTY" >>/tmp/debug.txt<br></div><div>       exit 0<br></div><div>esac<br>CURR_TTY_N=${CURR_TTY#/dev/tty}<br><br></div><div>** switch to tty 63**<br></div><div>** display dialog **<br><br></div><div>chvt $CURR_TTY_N<br></div><div><br><br>shutdownselect.service (which is required in ctrl-alt-del.target)<br><br>[Unit]<br>Description=Reboot GUI<br>DefaultDependencies=no<br>AllowIsolate=yes<br>JobTimeoutSec=30min<br>JobTimeoutAction=reboot-force<br><br>[Service]<br>ExecStart=/tmp/shutdownselect<br></div></div>