2

I would like to run this command in boot time:

/usr/games/lolcat /home/decker/file-with-text-content

This command prints "colored" content of /home/decker/test text file.So it would be something like welcome message during bootup process.

Tested this command when logged in in terminal.

I tried following, but nothing works:

  1. added "/usr/games/lolcat /home/decker/test" to /etc/rc.local
  2. created systemd service that should start this in boot time. (and was successfuly started, but I did not see colored content...)
  3. (very) desperately added "/usr/games/lolcat /home/decker/test" to /etc/init.d/procps. I was very desperate...

Tried with and without "quite" kernel boot arg.

Back in my days, when no systemd was here, this was simple. I have no idea what to do now.

In ideal world, I would like to place it after fsck messages while using "quite" kernel boot arg. (So there would be only messages with booting kernel name, fsck and colored welcome message). I dont want to use plymouth.

EDIT: So, thanks again for answers guys. We moved forward, but still no go. No rainbows. I added 3 mentioned lines to journalctl.conf. There is everything else commented out, so these 3 lines are there "alone". Then I added 2 mentioned lines to my unit. Content of my unit is:

[Unit]
Description=Peace Unicorn

[Service]
Type=simple
ExecStart=/bin/cat /home/decker/test5
StandardOutput=tty-force
TTYPath=/dev/tty12

[Install]
WantedBy=multi-user.target

When I restarted system, systemd printed this error:

[    4.817429] systemd[1]: [/etc/systemd/system/unicorn.service:7] Failed to parse output specifier, ignoring: tty-force

7th line is this: StandardOutput=tty-force. I tried to change it to "tty" only, but that did not printed anything.

Also I changed to "/bin/cat" from "lolcat" to focus on systemd problem for now.

1 Answer 1

2

Your rainbows are being sent to journalctl, which manages stderr and stdout for all systemd units. If you want to enable tty output for a single unit, add this under your unit's [Service] section

StandardOutput=journal+console
TTYPath=/dev/tty12

This won't preserve any formatting codes, such as colors and extra spaces

Source

12
  • 1
    It is far better, surely, to simply adjust the standard output and error settings of the relevant unit so that they don't go through the journal in the first place, rather than change how all journalling is handled system-wide just for one thing?
    – JdeBP
    Commented Apr 6, 2015 at 1:03
  • Would be, yes, but that's provided there's a unit created. In the question, output from /etc/rc.local was going to journalctl as well. While the proper way is with a unit, I'm assuming the asker wants to duplicate the pre-systemd style boot
    – Outurnate
    Commented Apr 6, 2015 at 2:14
  • You've missed item #2 of the question.
    – JdeBP
    Commented Apr 6, 2015 at 10:00
  • Hrrm, still no go, but we are moving. I have edited the question with latest results. Commented Apr 7, 2015 at 23:07
  • Updated the answer. Try it again. Seems I don't know systemd as well as I thought.
    – Outurnate
    Commented Apr 7, 2015 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .