Skip to content

Instantly share code, notes, and snippets.

@marantz
Created December 12, 2019 02:18
Show Gist options
  • Save marantz/30fff00989dc64017d060388f41ce9f9 to your computer and use it in GitHub Desktop.
Save marantz/30fff00989dc64017d060388f41ce9f9 to your computer and use it in GitHub Desktop.
Change System User Automation Agent
# OpsManager 4.2.x
SERVICE_USER="ec2-user"
SERVICE_GROUP="users"
service mongodb-mms-automation-agent stop
chown -R $SERVICE_USER:$SERVICE_GROUP /data/
chown -R $SERVICE_USER:$SERVICE_GROUP /var/log/mongodb-mms-automation/
chown -R $SERVICE_USER:$SERVICE_GROUP /etc/mongodb-mms/
chown -R $SERVICE_USER:$SERVICE_GROUP /var/lib/mongodb-mms-automation/
sed -i 's/SERVICE_USER="mongod"/SERVICE_USER="'$SERVICE_USER'"\nSERVICE_GROUP="'$SERVICE_GROUP'"/g' /etc/init.d/mongodb-mms-automation-agent
sed -i 's/-g $SERVICE_USER/-g $SERVICE_GROUP/g' /etc/init.d/mongodb-mms-automation-agent
service mongodb-mms-automation-agent start
# OpsManager 4.0.x
SERVICE_USER="root"
SERVICE_GROUP="root"
service mongodb-mms-automation-agent stop
#chown -R $SERVICE_USER:$SERVICE_GROUP /data/
chown -R $SERVICE_USER:$SERVICE_GROUP /var/log/mongodb-mms-automation/
chown -R $SERVICE_USER:$SERVICE_GROUP /etc/mongodb-mms/
chown -R $SERVICE_USER:$SERVICE_GROUP /var/lib/mongodb-mms-automation/
sed -i "s#User=.*#User=$SERVICE_USER#g" /etc/systemd/system/mongodb-mms-automation-agent.service
sed -i "s#mongod\:mongod#$SERVICE_USER\:$SERVICE_USER#g" /etc/systemd/system/mongodb-mms-automation-agent.service
systemctl daemon-reload
service mongodb-mms-automation-agent start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment