Tag: Systemd

systemd – start service when you enable it

More often than not for any service, I end up doing :

systemctl enable <service>
systemctl start <service>

But there is shorcut to this. In systemctl command when you enable the service, you can use “–now” to start the service as follows:

systemctl enable --now <service>

quite a timesaver 🙂

journalctl command to see kernel messages

Sometimes, there are just too many messages in journalctl output and it becomes a mystery game to search for the messages you are looking for. But luckily you do not need to use grep to find the right message. Here is example of what I had to do when I was looking for kernel messages.

journalctl _TRANSPORT=kernel
# To see all the fields, you can use the verbose mode
journalctl _TRANSPORT=kernel -o verbose

# And the filter on priority if needed to get the messages you need
journalctl _TRANSPORT=kernel PRIORITY=4

# and follow
journalctl _TRANSPORT=kernel PRIORITY=4 -f -l

PID File for squid in Fedora – 21 ( Fedora.next)

So, the other day, I wanted to have squid store its pid in the regular ‘var/run’ directory. Good simple enough – just add the following to “/etc/squid/squid.conf” :

pid_filename /var/run/squid/squid.pid

and create the /var/run/squid directory. Simple, hold on not so fast. Reboot and psssst.. ‘/var/run/squid’ is gone. Finally found that /var/run is handled by systemd-tmpfiles and thus you need to do this as well:

cat <>/lib/tmpfiles.d/squid.conf
d /run/squid 700 squid squid
EOF

So, basically you need to tell tmpfiles to create the squid directory as well.. How complicated things are becoming 🙂