I have a bash script using dialog which basically just checks the status of certain services and displays it as either up or down. It works fine when I run it while logged in. I can't seem to figure out how to configure CentOS 7 to run this script and dialog when the system boots up. Ideally once CentOS finishes loading all services, instead of display the login prompt it'll just present this dialog to the user. My research seems to keep pointing at creating a service using systemd but I can't seem to find an example to fit my needs. Thanks in advance.
Honestly, systemd services shouldn't be running interactive events. However, you should investigate the initial-setup-text.service, which does something like what you're asking for.
I assume you're not using a GUI? And you want to display these results where the system login banner would normally go, just before the login prompt?
My first thought would be to add a service which depends on all the other services, and which writes to /etc/issue.
But if you want to do this "instead of" the login prompt, how will you log in?
It won't look as pretty as
dialog but you could write your script to add its results to
/etc/issue so that it will be displayed immediately before the
The info will quickly become obsolete, though, so you should probably run the script from cron as well.
I'd suggest having some unique markers (before and after) your results message so that the cron job can search for and delete the old message before inserting the new.
Alternatively, have an
/etc/issue.head and/or an
/etc/issue.tail file to cat together with your results message.
myprog > /etc/issue.results cat /etc/issue.head /etc/issue.results /etc/issue.tail > /etc/issue