sed commands to automate the manually edit of mongod config file
up vote
-2
down vote
favorite
bash script using sed commands. Can anyone suggest the commands to change the mongo config file, i.e I need dbpath: /var/lib/mongo
to /data/db
and in the same config file I need to uncomment security (#security and add authorization= enabled) using sed commands.
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
bash sed
New contributor
add a comment |
up vote
-2
down vote
favorite
bash script using sed commands. Can anyone suggest the commands to change the mongo config file, i.e I need dbpath: /var/lib/mongo
to /data/db
and in the same config file I need to uncomment security (#security and add authorization= enabled) using sed commands.
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
bash sed
New contributor
2
are you looking for someone to do this for you? normally you have a specific thing you don't understand and ask us about. then with answers to complete your knowledge, you can do the coding task.
– Skaperen
Nov 18 at 5:04
I am trying with sed commands but I am getting an error, but If us sed replace command with a simple example to test its working...I am new to bash scripting.
– subbbu
Nov 18 at 5:14
I used this command to change the sed -i 's/dbPath: /var/lib/mongo/data/db/g' /etc/mongod.config...I am getting this error sed: -e expression #1, char 27: unterminated `s' command
– subbbu
Nov 18 at 5:20
See How to replace a string with a string containing slash with sed?
– steeldriver
2 days ago
Please ask about one thing at a time
– Zanna
2 days ago
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
bash script using sed commands. Can anyone suggest the commands to change the mongo config file, i.e I need dbpath: /var/lib/mongo
to /data/db
and in the same config file I need to uncomment security (#security and add authorization= enabled) using sed commands.
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
bash sed
New contributor
bash script using sed commands. Can anyone suggest the commands to change the mongo config file, i.e I need dbpath: /var/lib/mongo
to /data/db
and in the same config file I need to uncomment security (#security and add authorization= enabled) using sed commands.
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
bash sed
bash sed
New contributor
New contributor
edited 2 days ago
karel
54.8k11119138
54.8k11119138
New contributor
asked Nov 18 at 4:51
subbbu
1
1
New contributor
New contributor
2
are you looking for someone to do this for you? normally you have a specific thing you don't understand and ask us about. then with answers to complete your knowledge, you can do the coding task.
– Skaperen
Nov 18 at 5:04
I am trying with sed commands but I am getting an error, but If us sed replace command with a simple example to test its working...I am new to bash scripting.
– subbbu
Nov 18 at 5:14
I used this command to change the sed -i 's/dbPath: /var/lib/mongo/data/db/g' /etc/mongod.config...I am getting this error sed: -e expression #1, char 27: unterminated `s' command
– subbbu
Nov 18 at 5:20
See How to replace a string with a string containing slash with sed?
– steeldriver
2 days ago
Please ask about one thing at a time
– Zanna
2 days ago
add a comment |
2
are you looking for someone to do this for you? normally you have a specific thing you don't understand and ask us about. then with answers to complete your knowledge, you can do the coding task.
– Skaperen
Nov 18 at 5:04
I am trying with sed commands but I am getting an error, but If us sed replace command with a simple example to test its working...I am new to bash scripting.
– subbbu
Nov 18 at 5:14
I used this command to change the sed -i 's/dbPath: /var/lib/mongo/data/db/g' /etc/mongod.config...I am getting this error sed: -e expression #1, char 27: unterminated `s' command
– subbbu
Nov 18 at 5:20
See How to replace a string with a string containing slash with sed?
– steeldriver
2 days ago
Please ask about one thing at a time
– Zanna
2 days ago
2
2
are you looking for someone to do this for you? normally you have a specific thing you don't understand and ask us about. then with answers to complete your knowledge, you can do the coding task.
– Skaperen
Nov 18 at 5:04
are you looking for someone to do this for you? normally you have a specific thing you don't understand and ask us about. then with answers to complete your knowledge, you can do the coding task.
– Skaperen
Nov 18 at 5:04
I am trying with sed commands but I am getting an error, but If us sed replace command with a simple example to test its working...I am new to bash scripting.
– subbbu
Nov 18 at 5:14
I am trying with sed commands but I am getting an error, but If us sed replace command with a simple example to test its working...I am new to bash scripting.
– subbbu
Nov 18 at 5:14
I used this command to change the sed -i 's/dbPath: /var/lib/mongo/data/db/g' /etc/mongod.config...I am getting this error sed: -e expression #1, char 27: unterminated `s' command
– subbbu
Nov 18 at 5:20
I used this command to change the sed -i 's/dbPath: /var/lib/mongo/data/db/g' /etc/mongod.config...I am getting this error sed: -e expression #1, char 27: unterminated `s' command
– subbbu
Nov 18 at 5:20
See How to replace a string with a string containing slash with sed?
– steeldriver
2 days ago
See How to replace a string with a string containing slash with sed?
– steeldriver
2 days ago
Please ask about one thing at a time
– Zanna
2 days ago
Please ask about one thing at a time
– Zanna
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
subbbu is a new contributor. Be nice, and check out our Code of Conduct.
subbbu is a new contributor. Be nice, and check out our Code of Conduct.
subbbu is a new contributor. Be nice, and check out our Code of Conduct.
subbbu is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1093889%2fsed-commands-to-automate-the-manually-edit-of-mongod-config-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
are you looking for someone to do this for you? normally you have a specific thing you don't understand and ask us about. then with answers to complete your knowledge, you can do the coding task.
– Skaperen
Nov 18 at 5:04
I am trying with sed commands but I am getting an error, but If us sed replace command with a simple example to test its working...I am new to bash scripting.
– subbbu
Nov 18 at 5:14
I used this command to change the sed -i 's/dbPath: /var/lib/mongo/data/db/g' /etc/mongod.config...I am getting this error sed: -e expression #1, char 27: unterminated `s' command
– subbbu
Nov 18 at 5:20
See How to replace a string with a string containing slash with sed?
– steeldriver
2 days ago
Please ask about one thing at a time
– Zanna
2 days ago