Created
December 1, 2016 20:21
-
-
Save double-z/806a2c34c497a1ea06735ebad7aff8b7 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
#!/usr/bin/env bash | |
# Exit if error and pipe any from ctl commands | |
#set -eo | |
# Stop Pushy Server | |
chef-server-ctl stop opscode-pushy-server | |
# Nuke it from DB | |
echo "drop database opscode_pushy;" | su -l opscode-pgsql -c "psql" | |
echo "DROP ROLE opscode_pushy" | su -l opscode-pgsql -c "psql" | |
echo "DROP ROLE opscode_pushy_ro" | su -l opscode-pgsql -c "psql" | |
# Stop everyone else so we can remove runit refs without complaints on start | |
chef-server-ctl stop | |
systemctl stop private_chef-runsvdir-start.service | |
# Remove and purge | |
yum remove opscode-push-jobs-server -y | |
dirs=" | |
/var/log/opscode/opscode-pushy-server | |
/var/opt/opscode-push-jobs-server | |
/opt/opscode-push-jobs-server | |
/etc/opscode-push-jobs-server | |
/opt/opscode/service/opscode-pushy-server | |
/opt/opscode/sv/opscode-pushy-server | |
/var/opt/opscode/nginx/etc/addon.d/10-push_jobs_upstreams.conf | |
/var/opt/opscode/nginx/etc/addon.d/10-push_jobs_external.conf | |
" | |
for ii in $dirs;do | |
if [ -e $ii ];then | |
echo "EXISTS $ii" | |
rm -rf $ii | |
else | |
echo "NOPE $ii" | |
fi | |
done | |
# Catch any outliers but prompt so no accidents | |
for ii in `find / -type d | grep push | grep -v 'dev-lxc' | egrep 'job|server'`;do | |
if [ -d $ii ];then | |
echo "EXISTS $ii" | |
rm -ri $ii | |
else | |
echo "NOPE" | |
fi | |
done | |
# Up we go | |
systemctl start private_chef-runsvdir-start.service | |
sleep 2 | |
# Not necessary at all but a quasi-sanity check of sorts | |
chef-server-ctl restart | |
echo "Grep push from ps aux" | |
ps aux | grep push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment