I'm new to Bash and I have a question about parsing the command output. I have 3 processes who have the same name "Process" and there are some criteria in this process, for example:
Process - A 10-B20-C30 process ... - A15 - B30-C40 ... Process -A 30-B40-C50 ... I have to handle the 'A' parameter and allocate them to an array If the procedures exist ¡° They are not present, I have to restart the process. I'm handling these processes:
`$ PS -ef | $ GREP -v grep | $ GREP process' This gives me the processes to run and I have to see which process does not run and it restarts with the help of 'a' parameter.
How can I get it?
in_array () {v to "$ {@: 2}"; [["$ V" = "$ 1"]] & amp; Amp; Return 0; done; Return 1; } Relaunch () {resonance "whatever you have to do to run it again with $ 1"} = = (10 15 30) current = () while read -r proc a av b bv c cv; Printf 'was a% s, b was% s, was c% s \ n' "$ av" "$ bv" "$ cv" # can be left running = ("$ {Running [@]}" "$ $ Av") For the item in "$ {clock [@]}" & lt; (PS-C process -o CMD =); "$ item" in "$ {$ { @]} "Relaunch" $ item "
Comments
Post a Comment