Automate your work with simple Shell Script

Shell Script to run root with password in one small script line?

Please check this script, it will help you to run commands directly.
Sometime it becomes every important to run commands direclty with root user.

passwd="enter your password here"
echo "enter command to run with root"
read command
echo $passwd | sudo -S $command


Install Mongodb in to your server using this script in 5mins


#import key
apt-key adv --keyserver hkp:// --recv 0C49F3730359A14518585931BC711F9BA15703C6
#Adding Repo
echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list`
#Database update for new repo
apt-get update
#command to install mongodb
apt-get install -y mongodb-org
#start service
service mongod start
service mongod restart

Important commands for mongodb

How to access mongodb remotely

vim /etc/mongo.conf


# bindIp:

service mongod restart

## Create User

use admin

db.createUser( { user: Important commands for mongodb"advancetracker", pwd: "B6g3940huwMB1Vp", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] })

## connect mongodb remotely using this comment

mongo --host --port 27017 -u advancetracker -p --verbose --authenticationDatabase admin


I love helping beautiful people like you. I love hanging out with my dogs.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.