How do I run the latter and print my script output at boot time using systemd?
I am trying to set up my host during the deployment process and provide a screen output of what my config script is doing.
In RHEL6, it was easy for me to echo what I want to display or use a dialog to display output, and it was only when my script was executed that I got a login prompt.
- (i used rc3.d or rc5.d folder named script S99.myscript.sh)
In RHEL7, I cannot reproduce this process. rc.local does not display my result at boot time, nor does it guarantee it will run last.
I think I need to create a systemd system file that will run my script.
But how do you display the result on the screen during loading?
And how can I make sure I don't get a login prompt before my script finishes?
+3
source to share
1 answer
below example service works like a charm :)
[Unit] Description=ldt_bootscript1.service After=network.target Before=getty@tty1.service [Service] Type=oneshot ExecStart=/bin/bash -c "/bin/bash /tmp/ldt_scripts/postinstall/rc.firstboot.qas | /usr/bin/dialog --clear --backtitle \"Linux Deployment\" --title \"tests\" --progressbox 20 70 > /dev/console 2>&1" ExecStartPre=/usr/bin/echo -e \033%G ExecReload=/bin/kill -HUP $MAINPID RemainAfterExit=no WorkingDirectory=/ Environment=TERM=xterm [Install] WantedBy=multi-user.target
+3
source to share