[opensuse] systemd: What is the proper manner to print a message to the screen from a service file?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have: Telcontar:~ # cat /etc/systemd/system/helloworld.service [Unit] Name=Plays a welcome sound when target multi-user is reached After=multi-user.target # graphical.target - multi-user.target [Service] Type=oneshot RemainAfterExit=true ExecStart=-/usr/local/bin/helloworld [Install] WantedBy=multi-user.target Telcontar:~ which runs this script: Telcontar:~ # cat /usr/local/bin/helloworld #!/bin/bash # -x # # Author: Carlos E. Robinson # # Supersedes /etc/init.d/helloworld # called from /etc/systemd/system/helloworld.service cat /usr/share/sounds/au/hal9.au > /dev/audio & /bin/logger -t Mine -p syslog.info "Saying hello world" #Does not print - it does on syslog, not to terminal. grep FAILED /var/log/boot.log Telcontar:~ # The script runs, but the output of grep goes to syslog; I want it to got to the terminal (tty1, actually), in order to see at a glance which services failed to start (this was something that systemv did). - -- Cheers Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlG9wi4ACgkQtTMYHG2NR9Wa5QCfWlfYRhciB0z3gTw0qnAgRrs9 NIIAoI3dPsSHI5g5NurqolGas+OW9bFV =5XAR -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
* Carlos E. R. <robin.listas@telefonica.net> [06-16-13 09:50]: [...]
#Does not print - it does on syslog, not to terminal. grep FAILED /var/log/boot.log Telcontar:~ #
The script runs, but the output of grep goes to syslog; I want it to got to the terminal (tty1, actually), in order to see at a glance which services failed to start (this was something that systemv did).
perhaps ??? echo `grep FAILED /var/log/boot.log` w/backticks, not single parenthesis untested. -- (paka)Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 http://en.opensuse.org openSUSE Community Member Registered Linux User #207535 @ http://linuxcounter.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 16/06/13 09:48, Carlos E. R. escribió: in order to see at a glance which
services failed to start (this was something that systemv did).
what the hell ? seriously.. to see what services failed you do not need any such thing... just execute systemctl --failed -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday, 2013-06-16 at 14:10 -0400, Cristian Rodríguez wrote:
El 16/06/13 09:48, Carlos E. R. escribió: in order to see at a glance which
services failed to start (this was something that systemv did).
what the hell ? seriously.. to see what services failed you do not need any such thing... just execute systemctl --failed
I do not want to execute anything by hand. I want just to look at my screen be told if there is something to see. Just tell me how to print the output of a command on the screen, please, from inside a service file. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlG+AhQACgkQtTMYHG2NR9UW8QCfVR/Ej8IiU17CFHlPSDa53+8H P+kAn0YqKWEdtSemywyU+FXtR1+AqutN =ubUG -----END PGP SIGNATURE-----
El 16/06/13 14:21, Carlos E. R. escribió:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Sunday, 2013-06-16 at 14:10 -0400, Cristian Rodríguez wrote:
El 16/06/13 09:48, Carlos E. R. escribió: in order to see at a glance which
services failed to start (this was something that systemv did).
what the hell ? seriously.. to see what services failed you do not need any such thing... just execute systemctl --failed
I do not want to execute anything by hand. I want just to look at my screen be told if there is something to see. Just tell me how to print the output of a command on the screen, please, from inside a service file.
You are trying to solve a problem the weirdest and arcanest way possible! If you want to see "failed" or "sucess" of services like you did in sysvinit at boot in tty1 remove "quiet" from the boot command line. Otherwise please read the documentation, man page systemd.exec , option StandardOutput, yoiu can send the output to a tty/syslog/journal etc. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday, 2013-06-16 at 14:29 -0400, Cristian Rodríguez wrote:
El 16/06/13 14:21, Carlos E. R. escribió:
I do not want to execute anything by hand. I want just to look at my screen be told if there is something to see. Just tell me how to print the output of a command on the screen, please, from inside a service file.
You are trying to solve a problem the weirdest and arcanest way possible!
I'm simply customising my system to my tastes, as simple as that. :-)
If you want to see "failed" or "sucess" of services like you did in sysvinit at boot in tty1 remove "quiet" from the boot command line.
I have that removed since days, that's not it. I want a summary at the end of the boot; to be exact, the output of a command.
Otherwise please read the documentation, man page systemd.exec , option StandardOutput, yoiu can send the output to a tty/syslog/journal etc.
It works, thanks :-) Ok, I have: Telcontar:~ # cat /etc/systemd/system/helloworld.service [Unit] Name=Plays a welcome sound when target multi-user is reached After=multi-user.target # graphical.target - multi-user.target [Service] Type=oneshot RemainAfterExit=true StandardOutput=tty ExecStart=-/usr/local/bin/helloworld [Install] WantedBy=multi-user.target Telcontar:~ # Telcontar:~ # cat /usr/local/bin/helloworld #!/bin/bash # -x # # Author: Carlos E. R. # # Supersedes /etc/init.d/helloworld # called from /etc/systemd/system/helloworld.service cat /usr/share/sounds/au/hal9.au > /dev/audio & /bin/logger -t Mine -p syslog.info "Saying hello world" #Does not print - it does on syslog, not to terminal. grep FAILED /var/log/boot.log Telcontar:~ # It plays that cute sound file, and echoes the failed list to tty1, just what I want, at the end of the boot sequence. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlG+CL4ACgkQtTMYHG2NR9Wx7ACdE1g28QnArHe+rxwe2HxZS7z5 2z0AnjKYkUSf9TniT15ItEj+766EZCCa =Z84P -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 В Sun, 16 Jun 2013 20:49:34 +0200 (CEST) "Carlos E. R." <robin.listas@telefonica.net> пишет:
ExecStart=-/usr/local/bin/helloworld
...
#Does not print - it does on syslog, not to terminal. grep FAILED /var/log/boot.log
Does it work when you start it manually? Does it work if you omit "quiet" from kernel command line? -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlG+eygACgkQR6LMutpd94y5mwCcCRLiqCv+nrY5y2Jn0wM1p+77 67QAoKqCoT8niMmWpXHN3Y/m6EMqtdAk =aMwn -----END PGP SIGNATURE----- N▀╖╡ФЛr╦⌡yИ ┼Z)z{.╠О╝·к⌡╠йБmЙ)z{.╠Й+│:╒{Zrшaz▄'z╥╕j)h╔ИЛ╨г╬ё ч╝┼^·к╛z┼Ю
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Content-ID: <alpine.LNX.2.00.1306171104560.5885@Telcontar.valinor> On Monday, 2013-06-17 at 06:57 +0400, Andrey Borzenkov wrote:
В Sun, 16 Jun 2013 20:49:34 +0200 (CEST) "Carlos E. R." <> пишет:
ExecStart=-/usr/local/bin/helloworld
...
#Does not print - it does on syslog, not to terminal. grep FAILED /var/log/boot.log
Does it work when you start it manually? Does it work if you omit "quiet" from kernel command line?
I think you missed part of the emails :-) I'm not using "quiet" at all, it is one of the first things I remove. And Cristian told me to use "StandardOutput=tty" in the service file, and that was the trick. It is working now :-) The output of "grep FAILED /var/log/boot.log" is nicer, but that file only exists if plymouth runs - and it doesn't in my machine, I removed it. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlG+0YEACgkQtTMYHG2NR9VfEQCfVD2G/7siS1XHBSJJ/3yCpBeY ViwAnjugnHdEjunHuwJ2gIMEAGoYPHqK =V71N -----END PGP SIGNATURE-----
On 6/16/2013 2:10 PM, Cristian Rodríguez wrote:
El 16/06/13 09:48, Carlos E. R. escribió: in order to see at a glance which
services failed to start (this was something that systemv did).
what the hell ? seriously.. to see what services failed you do not need any such thing... just execute systemctl --failed
Wasn't this about echoing to a tty? You cut that part. How do I tell my serial logger to "just execute systemctl --faled" ? How do I see that stuff as it's happening, or left on a screen or a printer or a logger, instead of presuming that the system will come up and be functional enough for me to execute any such thing? -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 16/06/13 18:56, Brian K. White escribió:
How do I tell my serial logger to "just execute systemctl --faled" ?
to log systemd output to a serial console..well.. you just have to use the relevant kernel parameters and debug level selection console=ttyXX,XXXX systemd.log_level=debug systemd.log_target=console nothing else is needed... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Content-ID: <alpine.LNX.2.00.1306170112530.6527@Telcontar.valinor> On Sunday, 2013-06-16 at 19:05 -0400, Cristian Rodríguez wrote:
nothing else is needed...
My idea is to have a small summary at the end of the boot process, printed in tty1, and I have it now. I boot in text mode, verbose, I like to see the messages, and the summary at the end just in case I missed some. This command: grep FAILED /var/log/boot.log prduces exactly what I would like, but the file is not generated always, so it can not be relied uppon: +++······································· Telcontar:~ # grep FAILED /var/log/boot.log [FAILED] Failed to start Load Kernel Modules. [FAILED] Failed to start LSB: Console mouse support. [FAILED] Failed to start Daemonized version of spamassassin. [FAILED] Failed to start Network Manager Wait Online. ·······································++- So instead I'm using this: +++······································· Telcontar:~ # systemctl --failed --no-pager 0 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'. Telcontar:~ # ·······································++- but the format is not so nice. I would prefer it at least to print nothing if nothing failed. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlG+SFgACgkQtTMYHG2NR9U6GQCgkP0MhwZSzb81z5hYoTaGGe2/ Q6UAn1zt6o0mXBrRRfzwRU6o44Btl7Oa =X1DT -----END PGP SIGNATURE-----
participants (5)
-
Andrey Borzenkov
-
Brian K. White
-
Carlos E. R.
-
Cristian Rodríguez
-
Patrick Shanahan