#!/bin/bash

JUJU_DIR="/var/lib/juju"
DUMMY_DIR="/var/run/dummy-sink"
ips="$@"
for ip in $ips; do
    ssh -i $JUJU_HOME/staging-juju-rsa ubuntu@$ip <<EOT
#!/bin/bash
set -ux
if [[ -n "$(ps ax | grep jujud | grep -v grep)" ]]; then
    sudo killall -SIGABRT jujud
    sudo killall -9 mongod
fi
if [[ -d $JUJU_DIR ]]; then
    sudo rm -r $JUJU_DIR
fi
if [[ -d $DUMMY_DIR ]]; then
    sudo rm -r $DUMMY_DIR
fi
sudo find /etc/init -name 'juju*' -delete
EOT
done

#!/bin/bash

JUJU_DIR="/var/lib/juju"
DUMMY_DIR="/var/run/dummy-sink"
ips="$@"
for ip in $ips; do
    ssh -i $JUJU_HOME/staging-juju-rsa ubuntu@$ip <<"EOT"
#!/bin/bash
set -ux
if [[ -n "$(ps ax | grep jujud | grep -v grep)" ]]; then
    sudo touch /var/lib/juju/uninstall-agent
    sudo killall -SIGABRT jujud
    sudo killall -9 mongod
fi
if [[ -d $JUJU_DIR ]]; then
    sudo rm -r $JUJU_DIR
fi
if [[ -d $DUMMY_DIR ]]; then
    sudo rm -r $DUMMY_DIR
fi
sudo find /etc/init -name 'juju*' -delete
EOT
done

Fix quoting in remove manual script and add new uninstall handling
Fix quoting in remove manual script and add new uninstall handling
