I have a systemd service that is making use of DynamicUser and StateDirectory in the unit file, so the service can be restarted freely without losing data. However sometimes I want to completely clean up any persistent data and start it from a blank state, can I do that with some parameters to the systemctl stop command?
EDIT: I'm looking for an official parameter supported by systemctl that will clear all persistent data, not a way to pass arguments to my script.
Asked
Active
Viewed 2,693 times
2
Qtag
- 115
2 Answers
2
From the manual of systemd.exec:
The directories specified with StateDirectory=, CacheDirectory=, LogsDirectory=, ConfigurationDirectory= are not removed when the unit is stopped.
There is no official argument supported by systemd that clears these directories. You can use a script to do that.
Fanatique
- 5,153