Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Manage pulp-related services en-masse
- function ensure_services_running {
- for s in mongod.service qpidd.service pulp_celerybeat.service pulp_resource_manager.service pulp_workers.service httpd.service; do
- ISACTIVE="99"
- COUNTER="0"
- while [ "$ISACTIVE" != 0 ]; do
- systemctl is-active "$s" > /dev/null
- ISACTIVE="$?"
- if [ "$ISACTIVE" != 0 ]; then
- systemctl start $s 2>&1
- sleep 3
- COUNTER=$((COUNTER+1))
- fi
- if [ $COUNTER -gt 10 ]; then
- exit 0
- fi
- done
- done
- }
- case $1 in
- status)
- systemctl -n 0 status mongod qpidd httpd pulp_celerybeat pulp_resource_manager pulp_workers
- ;;
- full-status)
- systemctl status mongod qpidd httpd pulp_celerybeat pulp_resource_manager pulp_workers
- ;;
- start)
- ensure_services_running
- ;;
- stop)
- systemctl stop pulp_resource_manager pulp_celerybeat pulp_workers httpd qpidd mongod
- ;;
- restart)
- services="qpidd httpd pulp_celerybeat pulp_resource_manager pulp_workers"
- systemctl restart $services
- for s in $services; do
- echo "Service $s is $(systemctl is-active $s)"
- done
- ;;
- full-restart)
- services="mongod qpidd httpd pulp_celerybeat pulp_resource_manager pulp_workers"
- systemctl restart $services
- for s in $services; do
- echo "Service $s is $(systemctl is-active $s)"
- done
- ;;
- *)
- cat << EOF
- This script isn't smart enough for that option; avail options are:
- status - show short status of all Pulp services
- full-status - status + journalctl messages
- start - start up Pulp services in sane order
- stop - shut down Pulp services in sane order
- restart - restart all Pulp services in sane order, except Mongo
- full-restart - even restart mongo; you probably don't want to do this
- EOF
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement