forked from linux/documentation
1.7 KiB
1.7 KiB
Systemd
- List status of services
# list status of all services
systemctl status
# list status specific service
systemctl status yourservice
- List all systemd timers:
systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Wed 2018-06-27 16:45:01 CEST 2h 16min left Tue 2018-06-26 16:45:01 CEST 21h ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Thu 2018-06-28 07:31:00 CEST 17h left Wed 2018-06-27 07:31:25 CEST 6h ago pli-puppet-run.timer pli-puppet-run.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
Logs
All systemd logs end up in journald. One important exception is sssd which provides authentication against Active Directory. Its logs can be found in
/var/log/sssd.
Debug Service Start Failure
Wrapper to Catch Output
To catch all the output in a file write a small wrapper:
#!/usr/bin/bash
LOGFILE=/tmp/test.log
echo "$(date): " "$@" >> $LOGFILE
exec "$@" &>> $LOGFILE
and store it e.g. as /root/systemd_debug_starter.sh.
Then inject it into the daemon startup in the unit file with
ExecStart=/root/systemd_debug_starter.sh $ORIGINAL_EXECUTABLE
then you need to run
systemctl daemon-reload
systemctl start $SERVICE
and check out the log file.
Strace
If the error is more subtle, like problems with SIGPIPE, strace can be useful to unveil the problem.
You may inject strace into the daemon startup in the unit file with
ExecStart=strace -D -f -o /tmp/strace.txt $ORIGINAL_EXECUTABLE
then you need to run
systemctl daemon-reload
systemctl start $SERVICE
and check out the log file.