[ASAP] Execute an interactive script at boot with systemd
See the full postGoal
Execute an interactive script on tty2 (using dialog) at boot with systemd.
Files
/usr/lib/systemd/system/simple-window-dialog.service
:
[Unit]
Description=Simple interactive dialog window
After=getty@tty2.service
[Service]
Type=oneshot
ExecStart=/usr/bin/dialog-hello.sh
StandardInput=tty
TTYPath=/dev/tty2
TTYReset=yes
TTYVHangup=yes
[Install]
WantedBy=default.target
/usr/bin/dialog-hello.sh
(add execution permission):
#!/bin/bash
sleep 5
chvt 2
dialog --msgbox "Hello world!" 10 40
Enable the systemd service
# systemctl enable simple-window-dialog.service
Or
# ln -sf /usr/lib/systemd/system/simple-window-dialog.service /usr/lib/systemd/system/default.target.wants/simple-window-dialog.service
Run
Reboot (if the systemd setup is correct you should see the dialog window) enjoy.