Created
March 3, 2015 17:34
-
-
Save robtuley/c2cdbabf9aa97c77627b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| if [ "$#" -ne 1 ]; then | |
| echo "Usage: $0 your-service-prefix" >&2 | |
| exit 1 | |
| fi | |
| fleetctl list-units | grep $1@ | cut -f1 -d. | while read -r unit ; do | |
| unit_index=`echo $unit | cut -f2 -d@` | |
| printf "unit:> %s index:> %s\n" $unit $unit_index | |
| printf "stopping:> %s\n" $unit | |
| fleetctl stop $unit | |
| printf "waiting:> for %s to stop " $unit; | |
| is_running=1 | |
| while [ $is_running -ne 0 ]; do | |
| is_running=`fleetctl list-units | grep running | grep $unit | wc -l`; | |
| sleep 1; | |
| printf "."; | |
| done | |
| printf "\n" | |
| printf "starting:> %s\n" $unit | |
| fleetctl start $unit | |
| printf "waiting:> for %s to start " $unit; | |
| while [ $is_running -eq 0 ]; do | |
| is_running=`fleetctl list-units | grep running | grep $unit | wc -l`; | |
| sleep 1; | |
| printf "."; | |
| done | |
| printf "\n" | |
| fleetctl list-units | grep $unit | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment