Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a lable name when running a script

Status
Not open for further replies.

jones33

Programmer
Mar 20, 2007
14
GB
Hi,

is it possible to specify a label name for a unix script when running it?

Then when greping for the script afterwards one could just grep for the label name.

I want to be able to uniquely identify different instances of the same script running and I was wondering if I could add a unique label name to the run command when starting the script?

Many thanks for any ideas or suggestions.
 
You could give it a meaningless command-line argument as the "label", then use
Code:
ps -ef | grep myLabel | grep -v grep

If your script is already using command line arguments, you'll want to change their number so that the label can be the first one. For example, whatever you've identified as $1 should be $2 so that the label can be $1.

--
-- Ghodmode

Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top