2

I have a program that needs to run repeatedly. Now, I use supervisord's autorestart to do that. Currently I have:

command=myprogram --output-file=logfile.log

I want something like:

command=myprogram --output-file=logfile_%(date)s.log

which specifies an output-file as logfile_2015_08_13.log, except that supervisord only supports %(program_name)s, %(process_num)02d, etc.

foresightyj
  • 2,006
  • 2
  • 26
  • 40

1 Answers1

1

Supervisord supports more than just %(program_name)s, %(process_num)02d. You could pick you environment variables:Supervisord Environment

However I don't think you could pass shell commands in supervisord configuration. I would do something like this:

Write a shell script and call your program with the date command. Lets save it as run.sh

#!/bin/bash
myprogram --output-file=logfile_`date +%Y-%m-%d`

Pass your shell script as command to supervisord

command=/path/to/run.sh
Community
  • 1
  • 1
Mangat Rai Modi
  • 5,397
  • 8
  • 45
  • 75