I have a task:
work with many blogs in one time, from one shell.
I have many blogs on different hostes, but every blog is connected to one database. I mean i have one mysql server for all blogs. Differences is only table prefixes. Therefore i want to work with these blogs via shell scripting (or perl, or other) ?
My idea is to keep a config files:
file1 content:
url: url.com/path/toblog
prefix: sample1 #table prefix for this blog installation
Installation will work in next algorithm:
- Read config and init variables (url, prefix)
- check is tables already instantiated
2.1 yes remove tables - Copy tables
(MYSQL: create table tablename like default_installation_table)
Do it with all wordpress tables.
So what will be the best tool for doing it ?
It it perl, or pure bash scripting or python or combination of some of them ?
Shell script would be possible but a lot more work for you, both to develop and to debug. I’ve written and maintained large DB connecting apps in ksh and wouldn’t wish it on anyone.
As for the rest (Perl, Python etc…), if all you want is to manipulate data in MySQL database, any of them would do fine for the task, so pick whichever one of them you prefer based on your own ranking criteria (be it what you know best, or easiest for you to learn, or language you wanted to learn for a long time, or will help your further career).
I can definitely attest that Perl would be GOOD for that task (it has ready made modules for reading config files of all sorts, it has DBI modules for database connections); but to say it’s “best” is not really valid – the task isn’t specialized/complicated enough for Perl or Python to be significantly better.
Support wise, if you do enough of your own work, and ask good questions, both for Perl and Python you’ll find plenty of good coding advice right here on SO.