subject

Scenarios are quite common where an IT professional is tasked with modify a file on many computer systems or many files on a single computer or a combination of the two. For example, a large software may need the copyright notice comment to be changed on every source file in the project. Or, a configuration file may need to be modified on every server in a multi-server deployment. Doing this task manually is not a viable way to approach the problem. Instead, a better solution is to use a scriptable environment to perform search and replace functionality on the files in question. Python is an excellent tool for this kind of task. Description
Samba is a unix/linux file sharing suite of programs designed to provide Windows interoperable file and print sharing services. Much of the configuration for the Samba daemon is provided by the text file smb. conf (renamed to smb. txt for this assignment). After an update was deployed to three dozen linux servers it was discovered that a couple of configured parameters were incorrect. Unfortunately, since there are unique aspects to each server, copying the contents of a single file to each server is not a viable solution. To fix the problem, the IT department must connect to each server, edit the smb. conf file, and restart the smbd daemon. To automate this task, each server will have a Python script copied to it. Then an SSH session will be initiated to each server from which the script will be executed. Your task is to write the Python script.
The invocation of the script must be as follows:
python modify. py fileSpec "from" "to"
where,
modify. py is the name of your script
fileSpec is the name of the file to be modified (smb. txt)
"from" is the text to be searched for (be sure to enclose any white space in quotes.
"to" is the text the searched text is to be replaced with.
Testing the script is your responsibility. However a good test case is:
python modify. py smb. txt "password sync = yes" "password sync = no"

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:30, andyromero
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
image
Computers and Technology, 23.06.2019 12:00, kp2078
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, ayoismeisjjjjuan
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, nataliamontirl4230
Java the manager of a football stadium wants you to write a program that calculates the total ticket sales after each game
Answers: 1
You know the right answer?
Scenarios are quite common where an IT professional is tasked with modify a file on many computer sy...

Questions in other subjects:

Konu
Geography, 02.11.2020 14:10