Is there any way to set the process name of a shell script? This is needed for killing this script with the killall command.
Is there any way to set the process name of a shell script? This
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a way to do it, it is a hack/workaround but it works pretty good. Feel free to tweak it to your needs, it certainly needs some checks on the symbolic link creation or using a tmp folder to avoid possible race conditions (if they are problematic in your case).
Demonstration
wrapper
dummy
Test it using:
In another terminal, kill it using:
Notes
Make sure you can write in your current folder (current working directory).
If your current command is:
Set the script variable in wrapper to /path/to/file (instead of ./dummy) and call wrapper like this: