0

How can I disable systemd messages that pop up in my BASH script once in a while (for example, after I login to the machine via SSH from somewhere), like in the screenshot below ? The BASH script uses the dialog tool and I run it on Ubuntu 18.04. One thing I tried was disabling rsyslog, but it didn't help. Here is a screenshot to illustrate this behavior: link.

My systemd service file looks something like this:

[Unit]

Description=bashscript

After=network.target

After=getty.target

Conflicts=getty@tty1.service

[Service]

Type=oneshot

PIDFile=/run/bashscript.pid

ExecStart=/bin/openvt -s -w -- /path/to/bashscript

StandardInput=tty-force

StandardOutput=inherit

StandardError=inherit

[Install]

WantedBy=graphical.target

Thank you.

2

I think your issue is around the following lines

StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit

This means that the standard input takes in the input of /dev/console as there is now TTYPath specified in your service.

By setting standard output and standard error to inherit that means that they also take on the setting of standard input which in this case is /dev/console.

I'm not 100% on this but I imagine that is why you're seeing the output you're seeing. If you still need the input but don't want the output you should probably just have:

StandardInput=tty-force

Without the other two lines. If you're not actually using the Input though you can also get rid of that line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.