1
There is a process in my application that today whenever it runs keeps the name of the function as the name of the process in background.
However to perform some mapping, I wanted to customize the name of the process in the background.
Based on some examples of the Internet, I came up with the following model, however it is not working as it should.
I used a notation that is: bash -c "exec -a <NomeDoProcesso> <Comando>"
In my case, my script at the moment is that way:
bash -c "exec -a <NomeDoProcesso> nohup php index.php <Controller> <NomeDaFunção> > /var/www/log/ArquivoLog.log 2>&1 &"
However he still keeps on pulling the Function Name as the name of the process that is in the background, and not the Case name that I defined.
There is something wrong with my script or it is not really possible to move up the process with a custom name?
So I understand your suggestion and thank you for your contribution. But for example in my case, I would need the process name to be dynamic based on a variable of mine, even why within a PHP function I give the
exec()
to perform in bash. I don’t know if I’ve made that very clear in the question, that itself is my difficulty.– Vinicius Gabriel
In that case, how would you need to call
exec()
in php even to define the name of the process, it would not fit me to use a file.sh
for that reason.– Vinicius Gabriel
Vc was unclear. The post is marked as bash and Ubuntu, not php. And for what is written in your publication you are using the shell to call the execution of a php script.
– gorn
You are correct. I will give as answered because I tested your solution proposal and meets what I presented in the question.
– Vinicius Gabriel