Is there a way to know the current running config is outdated? Is there a way to view the current running config and compare it to the file?
It would be valuable for troubleshooting to know what the running config was before running reload. Also valuable if the command would tell me if it actually updated the config.
You can check loaded unit by command
systemctl show <unit>.service
. As far I know there is no tool to check changes in unit files.As well you could run this bash command
for var in $(systemctl | grep running | awk '{print $1}'); do systemctl status $var | grep "changed on disk" | grep ".service"; done
it would show what files has been changed.Example:
systemd
doesn't provide out of the box support for displaying changed unit files, but you can use a bash script like this:This line will do systemctl daemon-reload if needs to be run:
This worked for me:
or
It will output "NeedDaemonReload=yes" if it need to be reloaded.
If you use the grep method you can change the last part to
grep NeedDaemonReload=yes
orgrep NeedDaemonReload=no
to make it output nothing when it doesn't match (easier to use for scripting).You also may want to run this with
CanStart