Marching on: populating lists or tuples from textfiles - manipulating textfiles
astrophels at yahoo.com
Tue Aug 27 23:27:52 CEST 2002
First, thanks to those who helped me with my problem earlier, now I
can move to the next step.
As I said in an earlier post, this is version .2 of my server
ressurection program. My goal is to be able to easily 'ressurect' a
crashed server. I want to install FreeBSD, and pop a disk into the
drive and run this script, it will (through the ports collection)
install needed third party software, copy saved config files, and then
edit certain system files that we have an interest in not keeping on
disk. So I have definate improvements I want to make. Now that I've
(with much needed assistance from the group) figured out how to read
my lists, the next step is to kind of take them out of the picture.
What I'd like to do is this: Have three 'config' files for the program
to read. The first would tell the program which files to copy, for
example. Here is the syntax for this one:
# ServiceName SourcePath DestinationPath
BIND /mnt/named.conf -> /etc/namedb/named.conf
BIND /mnt/db.foo.com -> /etc/namedb/db.foo.com
BIND /mnt/db.bar.net -> /etc/namedb/db.bar.net
HTTPD /mnt/httpd.conf -> /usr/apache2/httpd.conf
I'd like python to read that file, populate a list, or possibly a
tuple with the correct information, and then run my file moving method
The next would give instructions for editing, the syntax would be as
#ServiceName Pathtofile Wanted Change
BIND /etc/rc.conf named_enabled=YES
SENDMAIL /etc/rc.conf sendmail_enabled=NONE
I'd like to read this file and fo into the listed config files and
make those changes. And the last file I want is one to restart
services. it would go as such
named -> named httpd
httpd -k start
basically I want to read this file, and restart or start the services
I am updating as needed.
If you guys could point me in the right direction I'd really
appreciate it. Right now, I need info on grabbing the data, and
populating the lists.
As stated before, please also reply to my e-mail - google takes 3
hours to update.
More information about the Python-list