forked from ungleich-public/cdist
		
	add support for __process --name (in theory)
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								40b7b158c0
							
						
					
				
			
			
				commit
				
					
						b8002efa6d
					
				
			
		
					 4 changed files with 21 additions and 4 deletions
				
			
		| 
						 | 
					@ -21,6 +21,10 @@
 | 
				
			||||||
# Check whether a process runs
 | 
					# Check whether a process runs
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
process="$__object_id"
 | 
					if [ -f "$__object/parameter/name" ]; then
 | 
				
			||||||
 | 
					   name="$(cat "$__object/parameter/name")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   name="$__object_id"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pgrep -x -f "$process" || true
 | 
					pgrep -x -f "$name" || true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,11 @@
 | 
				
			||||||
# __file is a very basic type, which will probably be reused quite often
 | 
					# __file is a very basic type, which will probably be reused quite often
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
process="$__object_id"
 | 
					if [ -f "$__object/parameter/name" ]; then
 | 
				
			||||||
 | 
					   name="$(cat "$__object/parameter/name")"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   name="$__object_id"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
runs="$(cat "$__object/explorer/runs")"
 | 
					runs="$(cat "$__object/explorer/runs")"
 | 
				
			||||||
state="$(cat "$__object/parameter/state")"
 | 
					state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
| 
						 | 
					@ -33,7 +37,7 @@ case "$state" in
 | 
				
			||||||
         if [ -f "$__object/parameter/start" ]; then
 | 
					         if [ -f "$__object/parameter/start" ]; then
 | 
				
			||||||
            cat "$__object/parameter/start"
 | 
					            cat "$__object/parameter/start"
 | 
				
			||||||
         else
 | 
					         else
 | 
				
			||||||
            echo "$process"
 | 
					            echo "$name"
 | 
				
			||||||
         fi
 | 
					         fi
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
| 
						 | 
					@ -47,4 +51,9 @@ case "$state" in
 | 
				
			||||||
         fi
 | 
					         fi
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
 | 
					   *)
 | 
				
			||||||
 | 
					      echo "Unknown state: $state" >&2
 | 
				
			||||||
 | 
					      exit 1
 | 
				
			||||||
 | 
					   ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,9 @@ state::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIONAL PARAMETERS
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
-------------------
 | 
					-------------------
 | 
				
			||||||
 | 
					name::
 | 
				
			||||||
 | 
					   Process name to match on when using pgrep -f -x.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stop::
 | 
					stop::
 | 
				
			||||||
   Executable to use for stopping the process.
 | 
					   Executable to use for stopping the process.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
 | 
					name
 | 
				
			||||||
stop
 | 
					stop
 | 
				
			||||||
start
 | 
					start
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue