Ubuntu Pastebin

Paste from katco at Thu, 25 Aug 2016 21:47:16 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/bin/bash

# This script will connect to Juju's mongo instance running in a LXC
# container.

: ${1?"Usage: $0 <LXC instance name>"}

LXC_NAME=$1
PASSWORD=$(lxc exec $LXC_NAME grep oldpassword /var/lib/juju/agents/machine-0/agent.conf |awk '{print $2}')
IPV4=$(lxc info $LXC_NAME |grep eth0 |grep -v inet6 |awk '{print $3}')

echo "Password: " $PASSWORD
echo "IP Address: " $IPV4
echo
mongo --ssl --sslAllowInvalidCertificates -u admin -p $PASSWORD $IPV4:37017/admin
Download as text