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:









share|improve this question









New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 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
    2 days ago










  • 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
    2 days ago










  • 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
    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















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:









share|improve this question









New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 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
    2 days ago










  • 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
    2 days ago










  • 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
    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













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:









share|improve this question









New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









karel

54.8k11119138




54.8k11119138






New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









subbbu

1




1




New contributor




subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






subbbu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 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
    2 days ago










  • 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
    2 days ago










  • 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
    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














  • 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
    2 days ago










  • 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
    2 days ago










  • 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
    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








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
2 days ago




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
2 days ago












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
2 days ago




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
2 days ago












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
2 days ago




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
2 days ago












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















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






subbbu is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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






























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.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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





















































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







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕