Debug your systemd services with journalctl
The chances are that if you're using linux, you will probably have run into systemd. If you find yourself in the situation where you've got a systemd service that keeps dying and you don't know why (I've been there before several times!), and there's nothing helpful in
/var/log, before you give up, you might want to give
journalctl a try. It's
systemd's way of capturing the output of a service and storing it in it's logging system (or something).
When I first found out about it, I read that apparently
journalctl -xe servicename would show me the logs for any given service. It turned out that it wasn't the case (it just threw a nasty error), so I went trawling through the
man pages and found the correct command-line switch. If you've got a service called
rocketbooster.service, and you want to see if
systemd has any logs stored for it, then you can execute this command:
journalctl --unit rocketbooster.service
...or for short
journalctl -u rocketbooster.service
It should open the logs (if there are any) in
less - with the oldest logs at the top, so you might need to scroll all the way down to the bottom to see anything that's relevant to your problem (shift + G will take you to the bottom of the file).
I've found that
systemd has a habit of rotating the logs too - and
journalctl doesn't appear to know how to access the rotated logs, so it's best if you use this command as soon as possible after failure (suggestions on how to access these rotated logs are welcome! Post down in the comment :D).
I thought I'd document it here in case it was useful to anyone - and so I don't forget myself! :P