By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

Programming Language for Systems Administrator

P: n/a
Hi All,

I am Windows Systems Administrator(planning to migrate to Linux
administration in near future), I have occassionally written few batch
files and Vbscripts to automate my tasks.

Now I have strong interest to learn a programming language that would
help me to write Scripts or Application ( In Systems Administrative
point of view) .

I have read on net that Python is the best way to start of for beginers
, Please let me your suggestions and help me out to chose to the right
programming language to write scripts ranging from simple automation
scripts to appliations for my workflow.

I am confused to chose between C++,Python,Perl.

Thanks in Advance

Kk

Jul 18 '05 #1
Share this Question
Share on Google+
24 Replies


P: n/a
In my experience, Python is more Windows-friendly than Perl. Mark
Hammond's Python Extensions for Windows are a lifesaver. You can
download the package from http://sourceforge.net/projects/pywin32/ or
install the ActiveState Python package, which includes the Windows
extensions.

I use Python for example to automate user and mailbox management in
Active Directory and Exchange. I also use the mxODBC module to interact
with SQL Server.

I warmly recommend "Python Programming on Win32" by Mark Hammond and
Andy Robinson (O'Reilly).

Grig

Jul 18 '05 #2

P: n/a

Kanthi Kiran Narisetti wrote:
Hi All,

I am Windows Systems Administrator(planning to migrate to Linux
administration in near future), I have occassionally written few batch files and Vbscripts to automate my tasks.

Now I have strong interest to learn a programming language that would
help me to write Scripts or Application ( In Systems Administrative
point of view) .

I have read on net that Python is the best way to start of for beginers , Please let me your suggestions and help me out to chose to the right programming language to write scripts ranging from simple automation
scripts to appliations for my workflow.

I am confused to chose between C++,Python,Perl.

Thanks in Advance

Kk


Jul 18 '05 #3

P: n/a
"Kanthi Kiran Narisetti" <Te********@gmail.com> wrote in
news:11********************@o13g2000cwo.googlegrou ps.com:
I am Windows Systems Administrator(planning to migrate to Linux
administration in near future), I have occassionally written few batch
files and Vbscripts to automate my tasks.

Now I have strong interest to learn a programming language that would
help me to write Scripts or Application ( In Systems Administrative
point of view) .
[...]
I am confused to chose between C++,Python,Perl.


I admin both Windows and Linux (Slackware, Debian) boxes, and I think
your best choice is either Python or learning bash scripting. C++ is just
no good - I use it for some large applications, but for sysadmin and
utility stuff it just takes 10 times as much work to get anything done as
Python does.

bash scripting is still the way most people seem to do these things on
linux (it's equivalent to batch files under Windows/DOS but far more
powerful), which is the reason I suggest you take a look at it - it's
still useful for writing small things that you want to send to other
people where you don't know if they have python installed. Of course this
is made less useful for you because you need to install a bash
interpreter on Windows so it's no longer cross platform.

I suggest you learn Python instead of Perl. Perl and Python are close
enough in terms of functionality (with a little give and take, please no
holy wars), so I wouldn't say one is Better than the other if you already
know it. But for someone starting from scratch I think you will find that
while the perl program may be smaller the python program will be far more
readable, maintainable, and easier to write.

I use bash scripting for small stuff (just simple command lines in
sequence), C++ and Java for a few things that require it (though I really
hate them both after using Python) and Python whenever I can. Python on
Linux/Windows is amazingly cross platform as long as you use functions
like os.path.join('dir','file') instead of hardcoding 'dir\\file' into
your code. And use the glob, shutil, and os libraries to do all your
hard work for you.
Jul 18 '05 #4

P: n/a
rbt
Kanthi Kiran Narisetti wrote:
Hi All,

I am Windows Systems Administrator(planning to migrate to Linux
administration in near future), I have occassionally written few batch
files and Vbscripts to automate my tasks.

Now I have strong interest to learn a programming language that would
help me to write Scripts or Application ( In Systems Administrative
point of view) .

I have read on net that Python is the best way to start of for beginers
, Please let me your suggestions and help me out to chose to the right
programming language to write scripts ranging from simple automation
scripts to appliations for my workflow.

I am confused to chose between C++,Python,Perl.

Thanks in Advance

Kk


I use Python for all sorts of Windows administration tasks. I can honestly say that
I've yet to find a better Windows scripting language. I've used it to migrate Mac
users to PCs (file conversions), laptop location reporting (ipconfig, route, etc.)...
to help recover stolen laptops, and most recently a social security number search
utility to identify files that should be safe guarded from identity theft hacks. See
the latter here:

http://filebox.vt.edu/users/rtilley/...find_ssns.html

In short, Python is the ideal language for scripting/programming on Windows computers.

Best of luck,

rbt
Jul 18 '05 #5

P: n/a
Looking at my followup, I really didn't make it clear that you'll have to
learn some bash scripting to be an effective *nix administrator, just
because so many parts of the system use bash scripting. But python is much
nicer to write anything non-trivial in.
Jul 18 '05 #6

P: n/a
>>>>> "Sizer" == Sizer <si***@nospam.com> writes:

Sizer> Looking at my followup, I really didn't make it clear that
Sizer> you'll have to learn some bash scripting to be an effective
Sizer> *nix administrator, just because so many parts of the
Sizer> system use bash scripting. But python is much nicer to
Sizer> write anything non-trivial in.

If you don't need to edit already existing system scripts, you don't
really need to know bash scripting. For debugging purposes, it's easy
to see what commands the script executes to perform a task.

You just need to know about `backticks` and $ENV_VARS, but that's more
general Unix knowledge than actual shell scripting.

So IMHO learning bash scripting might be a waste of time, and it
should be learnt 'as you go' - i.e. if/when you eventually bump into a
problem where you need to be able to do bash scripting. There's the
'Unix romantic' movement that still thinks shell scripts are a good
idea, but this is my .02EUR to point out that not everyone agrees with
them.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #7

P: n/a
Ville Vainio schrieb:
If you don't need to edit already existing system scripts, you don't
really need to know bash scripting. For debugging purposes, it's easy
to see what commands the script executes to perform a task.


This is only true for trivial bash scripts. I have seen bash scripts
which were quite hard to read especially for beginners.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 18 '05 #8

P: n/a
> I am confused to chose between C++,Python,Perl.

Writing scripts in C++, you'll just die of brain burn.

Python has very good shell integration and I heard it can do funky stuff
with COM/OLE with a few lines of code where you'd need a few pages worth
of impossible to understand COM code to do the same in C. Also basic shell
tasks like spawning processes, piping from / to their output, regular
expressions, parsing files, etc are a breeze. There are modules for INI
files, csv files, etc.

Perl should be about the same, but you have to like the scary syntax.
Jul 18 '05 #9

P: n/a
Ville Vainio wrote:
If you don't need to edit already existing system scripts, you don't
really need to know bash scripting. For debugging purposes, it's easy
to see what commands the script executes to perform a task.

You just need to know about `backticks` and $ENV_VARS, but that's more general Unix knowledge than actual shell scripting.

So IMHO learning bash scripting might be a waste of time, and it
should be learnt 'as you go' - i.e. if/when you eventually bump into a problem where you need to be able to do bash scripting. There's the
'Unix romantic' movement that still thinks shell scripts are a good
idea, but this is my .02EUR to point out that not everyone agrees with them.


The simplest script is just a set of commands one could run from the
command line. One step above is learning how to pass arguments (for
cmd.exe in Windows, they are just %1, %2, etc.) and set variables. I
think every computer user, not just system administrators, show know
this much about the shell language of his OS, regardless of whether
it's Windows, Unix, or something else. On Windows I often see people
"mousing around" instead of getting things done faster from the command
line.

I actually like the Windows cmd language (it's an acquired taste), but
I have read it is going away in Windows Longhorn (WH). That's an
argument for writing more complicated scripts in Python. WH is supposed
to get a much better shell, called Monad, inspired by the philosophy of
Gottfried Wilhelm Leibniz :).

Between a low-level shell scripting language and a higher-level
language like Python, and intermediate level language such as Rexx
could be considered. Many IBM people swear by it.

Jul 18 '05 #10

P: n/a
Hi All,

Thank You for your suggestions....I request you all to eloborate the
Uses(In Practical) for systems administrator.Some of my questions
regarding the same follows.

1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.

2)Which is best opensource database to be used with Python ?

3)When i write a remote execution script in python is it required that
python should be installed in remote system.

4)I heard about Perl/CGI and that CGI application done by python
too.....Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.

Sorry if these questions are out of this group , but answers to these ?
will help me a lot.

Thanks in Advance

Kanthi.

Jul 18 '05 #11

P: n/a


Kanthi Kiran Narisetti schrieb:
Hi All,

Thank You for your suggestions....I request you all to eloborate the
Uses(In Practical) for systems administrator.Some of my questions
regarding the same follows.

1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication. Yes, you can.
There are far too many options, to be listed here:
Here are just 3 pointers:
http://www.zope.org/
http://www.cherrypy.org/
http://www.webwareforpython.org/
http://skunkweb.sourceforge.net/

2)Which is best opensource database to be used with Python ? It's hard to say. It depends on our taste and the type of your application.
There is a python standard for a relation DB-API
and there are som object relational adapters, like:
http://python-dbo.sourceforge.net/
http://sqlobject.org/
http://skunkweb.sourceforge.net/PyDO/
http://dustman.net/andy/python/SQLDict

And, of course, there is ZODB the object oriented DB below Zope:
http://www.zope.org/Products/ZODB3.3


3)When i write a remote execution script in python is it required that
python should be installed in remote system. No.
Using xmlrpc the server and may be written in any programming language.
xmlrpc is include din the standard libray.
Other remote execution systems use CORBA or do things upon their own:
http://pyro.sourceforge.net/

It is also possible to package python applications in an executable using:
http://starship.python.net/crew/theller/py2exe/
http://starship.python.net/crew/atuining/cx_Freeze/
or the Freeze utility delivered with the python standard distribution.

4)I heard about Perl/CGI and that CGI application done by python
too.....Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating. No it's rather slow, but widley used. There is a mod_python for Apache
which is used be some of the web application frameworks mentioned above.
Sorry if these questions are out of this group , but answers to these ?
will help me a lot.

The are perfectly valid.

HTH,
Gerald

--
GPG-Key: http://keyserver.veridis.com:11371/search?q=0xA140D634

Jul 18 '05 #12

P: n/a

Hello,

I have some answers but for some of your questions, there are many
(possibly good) answers.
1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.

I believe you want something that is more just a mailing list. There are
at least 4 different solutions for creating web sites with Python.
Here are some:

Plone (www.plone.org)
Zope (Plone is build with Zope)
mod_python

Depends on what you need and how much time you have to do it.
2)Which is best opensource database to be used with Python ?


Under Windows platform, I would like to recommend PostgreSQL 8 - fast
enough, it has many data types, procedural languages, triggers,
contributed extensions. Supports nested transactions, deferrable
constraints etc. For small applications, it can be too heavy.
For smaller, simple applications you can consider FireBird. It is more
simple and lightweight.
I also tried SAP-DB before. I cannot tell too much about SAP but it
looked promising.
I do not recommend MySQL. If you really want to take advantage of the
modern concepts of today's database systems, you will notice that MySQL
is not standard enough and usually you will find something that you
cannot do with it. (Otherwise MySQL is very popular.)

You can also try other "object persistence" systems. (For example, ZODB
) They are not relational databases but they can be good for you.
3)When i write a remote execution script in python is it required that
python should be installed in remote system.

I'm not sure what it means. Are you talking about RPC? You can write COM
servers using Python. Does this answer your question?
4)I heard about Perl/CGI and that CGI application done by python
too.....Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.

CGI is still valid but nobody will recommend it to you. It is obsolete.
You should better use a templating or content management system. For
bigger sites, you can use a better web application server like Zope,
make the programming part at lower level. It requires more knowledge but
gives you virtually infinite number of possiblilites.
Sorry if these questions are out of this group , but answers to these ?
will help me a lot.

It seems to me that you have interests in various fields but it looks
you did not search on the internet.
For example, if you search for "web development Python wiki" on google
then you will get this link
on the first page:

http://www.fredshack.com/docs/pythonweb.html

I can't believe that you tried to get information from search engines.
Please do not ask this list to dig the information for you.
Search on the internet first. Use Python Wiki. Read the articles, read
at least the front pages of the tools found. Compare them yourself.
Then if you still need to choose between two but you cannot decide wich
one to use - you can come back and ask others what is their experience.

--
__________________________________________________ _______________
Laszlo Nagy web: http://designasign.biz
IT Consultant mail: ga*****@geochemsource.com

Python forever!
Jul 18 '05 #13

P: n/a

"Kanthi Kiran Narisetti" <Te********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
.Some of my questions
regarding the same follows.
Most of these have been discussed many times. You can use Google to search
the archives of this newsgroup. I strongly recommend that you learn to use
that resource.
1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.
Yes, see Google
2)Which is best opensource database to be used with Python ?
Currently being debated in another thread. See Google for previous
discussions.
3)When i write a remote execution script in python is it required that
python should be installed in remote system.


Yes. I think there are a couple of options that have been discussed.

Terry J. Reedy

Jul 18 '05 #14

P: n/a
be*******@aol.com said unto the world upon 2005-04-12 08:11:

<SNIP>
I actually like the Windows cmd language (it's an acquired taste), but
I have read it is going away in Windows Longhorn (WH). That's an
argument for writing more complicated scripts in Python. WH is supposed
to get a much better shell, called Monad, inspired by the philosophy of
Gottfried Wilhelm Leibniz :).


Hi all,

this is the first I've heard of Monad.

Leibniz characterized his monads as the fundamental building blocks of
nature, insusceptible of change from the outside, and as "windowless".

So, if the account of MS's plans is true, it would seem to indicate a
combination of arrogance, honesty, and ignorance. (I leave it to you
to decide which part, if any, of this triad, is surprising.)

Best to all,

Brian vdB

Jul 18 '05 #15

P: n/a
On Tue, 12 Apr 2005 15:41:46 +0200, Laszlo Zsolt Nagy
<ga*****@geochemsource.com> declaimed the following in comp.lang.python:
For smaller, simple applications you can consider FireBird. It is more
simple and lightweight.
Derived from the Interbase system...
I also tried SAP-DB before. I cannot tell too much about SAP but it
looked promising.
Now known as (or was, last time I checked) "MaxDB by MySQL"

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #16

P: n/a
>> I also tried SAP-DB before.
Now known as (or was, last time I checked) "MaxDB by MySQL"


and formerly known as the pre-relational dbms 'Adabas'. I think the
only reason for its continued existance is that SAP was hoping for a
very low cost, low-end database years ago. However, the database world
has changed substantially over the last ten years: you can get
postgresql and firebird for nothing, and db2 & oracle are often under
$1000 for a small server.

With that in mind I can't think of a database that's more of a has-been
than maxdb. Maybe something from the 70s like IMS-DB or Model 204?

buck

Jul 18 '05 #17

P: n/a

Thank You for your suggestions....I request you all to eloborate the
Uses(In Practical) for systems administrator.Some of my questions
regarding the same follows.
What do you want to do ?
1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.
Sure, you could use mod_python+apache2 or Zope, Skunkweb... there's a lot
of options depending on what you need. I find it better than PHP because
it'll raise exceptions when you do something funky. PHP's way of ignoring
missing keys in arrays or silent type conversions is a double ended sword
and can simplify code as well as giving hard to trace bugs.
2)Which is best opensource database to be used with Python ?
I like postgresql a lot, and the psycopg adapter for python is great.
3)When i write a remote execution script in python is it required that
python should be installed in remote system.
Yes.
4)I heard about Perl/CGI and that CGI application done by python
too.....Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.


CGI will be slow as it spawns an interpreter for each request. See
mod_python.
Jul 18 '05 #18

P: n/a
Brian van den Broek wrote:
be*******@aol.com said unto the world upon 2005-04-12 08:11:

<SNIP>
I actually like the Windows cmd language (it's an acquired taste), but I have read it is going away in Windows Longhorn (WH). That's an
argument for writing more complicated scripts in Python. WH is supposed to get a much better shell, called Monad, inspired by the philosophy of Gottfried Wilhelm Leibniz :).
Hi all,

this is the first I've heard of Monad.

Leibniz characterized his monads as the fundamental building blocks

of nature, insusceptible of change from the outside, and as "windowless".
So, if the account of MS's plans is true, it would seem to indicate a combination of arrogance, honesty, and ignorance. (I leave it to you
to decide which part, if any, of this triad, is surprising.)

Best to all,

Brian vdB


I was joking about Leibniz, but from the Wikipedia article
http://en.wikipedia.org/wiki/MSH_(shell) it appears that the codename
of the new Microsft shell was in small part inspired by the philosophy
of Leibniz:

"Central concepts
The system's codename comes from Gottfried Leibniz's "Monadology", a
philosophy which says that everything is a composition of fundamental
elements called 'Monads', which are all integrated together in
'pre-established harmony'. Similarly, the focus of MSH is on
composition of complex tasks from a series of components. In this case,
the components are special programs called commandlets (or cmdlets),
which are .NET classes designed to use the features of the environment.
The key difference between the Unix approach and the MSH one is that
rather than creating a "pipeline" based on textual input and output,
MSH passes data between the various commandlets as arbitrary objects.

If accessed individually from the command-line, a commandlet's output
will automatically be converted into text, but if its output is to be
used by another commandlet, it will be converted into whatever form of
object is most appropriate for that commandlet's input. This has the
advantage of eliminating the need for the many text-processing
utilities which are common in Unix pipelines, such as grep and awk, as
well as allowing things to be combined interactively, or in a scripting
environment, which would otherwise require a more complex programming
language. For instance, a listing of processes will consist not of text
describing them, but objects representing them, so that methods can be
called on those objects without explicit reference to any outside
structure or library.

MSH is part of an overall strategy within Longhorn to treat all parts
of the OS as .NET objects, and thus allow the user greater flexibility
over how they are used. This is aimed to make previously complex
interactions manageable within the bounds of frameworks such as MSH;
for example, Longhorn's registry can be exported as though it were a
filesystem, and navigated by treating it as a hierarchy of files and
directories."

Jul 18 '05 #19

P: n/a
>>>>> "beliavsky" == beliavsky <be*******@aol.com> writes:

beliavsky> The key difference between the Unix approach and the
beliavsky> MSH one is that rather than creating a "pipeline" based
beliavsky> on textual input and output, MSH passes data between
beliavsky> the various commandlets as arbitrary objects.

They clearly read my rant from last summer

http://groups.google.com/groups?thre...zart.cc.tut.fi

;-)

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #20

P: n/a
Kanthi Kiran Narisetti wrote:
Hi All,

Thank You for your suggestions....I request you all to eloborate the
Uses(In Practical) for systems administrator.Some of my questions
regarding the same follows.

1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.
Look here:
http://www.python.org/moin/WebProgramming
2)Which is best opensource database to be used with Python ?
I personally think that Firebird is a very good Database:
http://www.firebirdsql.org/
http://kinterbasdb.sourceforge.net/
3)When i write a remote execution script in python is it required that
python should be installed in remote system.

4)I heard about Perl/CGI and that CGI application done by python
too.....Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.

Sorry if these questions are out of this group , but answers to these ?
will help me a lot.

Thanks in Advance

Kanthi.

Jul 18 '05 #21

P: n/a
Python is great, but having much "admin" type experience, I've found
python to be less than Ideal when dealing with system calls and
standard Input Ouput.

For example, I've written complex tools that use perforce, I've taken
advantage of both regular IO and the perforce marshalled IO. Under
heavy load, some of the threads in my scripts experience IO hang (Linux
and WIndows) (solaris and BSD were fine). I did not get the same
behavior with Perl.

Having said that I still do 99% of my utilities in python. Just be
aware.

Jul 18 '05 #22

P: n/a
pythonUser_07 wrote:
Python is great, but having much "admin" type experience, I've found
python to be less than Ideal when dealing with system calls and
standard Input Ouput.

For example, I've written complex tools that use perforce, I've taken
advantage of both regular IO and the perforce marshalled IO. Under
heavy load, some of the threads in my scripts experience IO hang (Linux
and WIndows) (solaris and BSD were fine). I did not get the same
behavior with Perl.

Having said that I still do 99% of my utilities in python. Just be
aware.


i've written some complex tools around perforce too, but i use the perforce
python module and get an order of magnitude better performance than when i use
popen to execute the same command (if that is what you are referring to by
"regular IO and marshalled IO". my app doesn't use threads, so i can't speak to
that, but i've never experienced an IO hang related to perforce.

bryan

Jul 18 '05 #23

P: n/a
Peter Maas wrote:

This is only true for trivial bash scripts. I have seen bash scripts
which were quite hard to read especially for beginners.


I've seen shell scripts which are quite hard to read
even for experts!

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
Jul 18 '05 #24

P: n/a
>>>>> "zsolt" == pythonUser 07 <zs***************@mailblocks.com> writes:

zsolt> Python is great, but having much "admin" type experience,
zsolt> I've found python to be less than Ideal when dealing with
zsolt> system calls and standard Input Ouput.

Have you tried the 'subprocess' module to see whether it solves your
problems, new in 2.4?

That said, I've never had the problems you describe with normal popen*
calls either.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #25

This discussion thread is closed

Replies have been disabled for this discussion.