| Hi Guys, Would it be possible to have a command baked into PE that can be run to stop, start and restart all puppet services in the correct order ie puppet infra run stopservices , startservices, restartservices? This would mean we would not need to ask customers to run several commands to stop and start all services related to puppet. I put something together with a rough idea of how I could achieve this but it would need a touch from the pros! I was thinking something like the following would work, but it may need some more logic to handle mcollective and pe-activemq... ``` #!/bin/bash declare -a arrPuppetServiceStop=("puppet" "pe-puppetserver" "pe-activemq" "mcollective" "pe-puppetdb" "pe-console-services" "pe-nginx" "pe-orchestration-services") declare -a arrPuppetServiceStart=("pe-postgresql" "pe-puppetserver" "pe-activemq" "mcollective" "pe-puppetdb" "pe-console-services" "pe-nginx" "pe-orchestration-services" "puppet") function puppetstop(){ servicesarr=("$@") for service in ${servicesarr[@]} do echo "Attempting to stop $service" puppet resource service $service ensure=stopped done } function puppetstart(){ servicesarr=("$@") for service in ${servicesarr[@]} do echo "Attempting to start $service" puppet resource service $service ensure=running done } function puppetstatuscheck(){ servicesarr=("$@") status=("$1") for service in ${servicesarr[@]} do echo "Checking status of $service" puppet resource service pe-puppetserver | grep ensure | sed -e 's|[",'\'']||g' | awk '{split($0,s," "); print s[3];}' done } state="$1" case "$state" in stop) echo "Trigger Stop action" puppetstop "${arrPuppetServiceStop[@]}" ;; start) echo "Trigger Start Action" puppetstart "${arrPuppetServiceStart[@]}" ;; *) echo "Only accepts Stop and Start" exit 1 esac ``` |