简体   繁体   中英

How to calculate variable in Upstart script and use it?

Is where any way to achieve this?

Some details:

I am trying to create log file for gunicorn with datetime in name.

Something like that, but it isn't works properly:

chdir /home/mypath
script
   log_file=./err_$(date +"%d_%m_%Y_%T").log
   exec gunicorn --error-logfile $log_file
end script

This approach fails too:

exec gunicorn --error-logfile ./err_$(date +"%d_%m_%Y_%T").log

For some reason, the shell started by the script stanza is unable to find the date command in its path. Use a hardcoded path:

script
    log_file=./err_$(/bin/date +"%d_%m_%Y_%T").log
    gunicorn --error-logfile $log_file
end script

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM