Configure systemd to output text to the console instead of reboot.


First, create a shell script to generate the output and send it to the console.

mkdir /etc/scripts
cat << EOF > /etc/scripts/ctrl-alt-del.sh 
#!/bin/sh

/bin/echo "" > /dev/console
/bin/echo "Nope. This isn't Windoze." > /dev/console
EOF

 Next, create the two systemd files.

rm -f /lib/systemd/system/ctrl-alt-del.target 
rm -f /lib/systemd/system/ctrl-alt-del.service

cat << EOF > /lib/systemd/system/ctrl-alt-del.target
[Unit]
DefaultDependencies=no
Description=Ctrl-Alt-Del
Requires=ctrl-alt-del.service
StopWhenUneeded=yes
EOF

cat << EOF > /lib/systemd/system/ctrl-alt-del.service 
[Service]
DefaultDependencies=no
Type=oneshot
ExecStart=/etc/scripts/ctrl-alt-del.sh
EOF

Finally, reload the systemd daemon.

systemctl daemon-reload

 

Tags: Linux, systemd
2018-03-20 21:15 Roy Kidder {writeRevision}
Average rating: 0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.