I want to see output from my systemctl commands. For example:
systemctl restart systemd-networkd
would display the output of
systemctl status systemd-networkd.
I know that I could write a script that always puts the commands sequentially but I am hoping there is something like
systemctl --verbose restart ....
that didn't make it into the man page.
systemctl restart p. service is a little different in that it will stop the service (if running), then start the service. This will affect an active (running) unit. this is true-the service was active, which did prevent its being triggered a second time.
To see the logs that the journald daemon has collected, use the journalctl command. When used alone, every journal entry that is in the system will be displayed within a pager (usually less ) for you to browse. The oldest entries will be up top: journalctl.
To check a service's status, use the systemctl status service-name command. I like systemd's status because of the detail given. For example, in the above listing, you see the full path to the unit file, the status, the start command, and the latest status changes.
Linux logs will display with the command cd/var/log. Then, you can type ls to see the logs stored under this directory. One of the most important logs to view is the syslog, which logs everything but auth-related messages.
To my knowledge, there is no such thing. That being said, you can go ahead and "make you own":
We're going to edit out bashrc file to add this as a an alias command
echo "startstat(){ systemctl start \$*; systemctl status \$* }" >> ~/.bashrc
Note that this will only work for bash sessions and for the user you're running it for, so don't run this inside stuff that doesn't run bashrc before starting.
You can then start services and immediately get the status by running
startstat [arguments to pass to BOTH systemctl start AND systemctl status]
Sample usage:
startstat systemd-networkd
If you want to wait a little bit before checking the status, you can always add a sleep between:
Just nano ~/.bashrc
, scroll to the bottom (or if you added things, whichever line it's at), and just add sleep [seconds];
between systemctl start \$*;
and systemctl status \$*;
If you want the status to be run after the start is finished, you can put a singular &
sign with a space in front of it between the \$*
and the ;
to fork it off into background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With