0

I think it's fairly obvious what I'm trying to do here

# Rename Log File
ExecStartPre=/bin/find /data/db/log/*.log -type f -exec mv {} {}.`date +"%Y%m%d-%H%M"` \;
# gzip past log files (is post becuase might take a long time)
ExecStartPost=/bin/find /data/db/log/*.log.2* -type f -mtime +2 -exec gzip {} \;
# delete really old stuff
ExecStartPost=/bin/find /data/db/log/*.log.2*.gz -type f -mtime +90 -delete

these get "Executable path contains special characters, ignoring"

Any suggestions what I'd need to do to get these working?

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
Loz
  • 1

1 Answers1

0

systemd does not expand glob patterns like *.log, and interprets several % prefixes as specifiers. It also parses \ before some characters. You therefore need to run the find command inside a shell, and escape % with %%, and \.

ExecStartPre=/bin/bash -c '/bin/find /data/db/log/*.log -type f -exec mv {} {}.`date +"%%Y%%m%%d-%%H%%M"` \\;'
meuh
  • 1,563
  • 10
  • 11