Linked by Eugenia Loli-Queru on Fri 14th Sep 2007 23:08 UTC
General Development As a system administrator, you run across numerous challenges and problems. Managing users, disk space, processes, devices, and backups can cause many system administrators to lose their hair, good humor, or sanity. Shell scripts can help, but they often have frustrating limitations. This is where a full-featured scripting language, such as Python, can turn a tedious task into an easy one. Python is a scripting language that looks like it was made for system administrators.
Order by: Score:
in some ways, I hate python
by jokhva (2.67) on Fri 14th Sep 2007 23:19 UTC
jokhva
Member since:
2007-09-14
Fans: 0

the first time i ran across python as system scripts was in a fresh gentoo install. it crashed each time i tried to proceed....

RE: in some ways, I hate python
by bnolsen (2.24) on Sat 15th Sep 2007 14:31 UTC in reply to "in some ways, I hate python"
bnolsen Member since:
2006-01-06
Fans: 0

gentoo is probably the worst advertisement for python. On anything but a very modern fast machine the portage operations are painfully, painfully slow and IMHO show exactly why scripting languages shouldn't be used too ambitiously for things. They just don't scale well.

RE[2]: in some ways, I hate python
by abraxas (3.48) on Sat 15th Sep 2007 14:56 UTC in reply to "RE: in some ways, I hate python"
abraxas Member since:
2005-07-07
Fans: 0

gentoo is probably the worst advertisement for python. On anything but a very modern fast machine the portage operations are painfully, painfully slow and IMHO show exactly why scripting languages shouldn't be used too ambitiously for things. They just don't scale well.

I don't think python is the real issue. Portage used to be very fast. Over the years though it has gotten bloated and inefficient. Extending it has been difficult and not without loss of efficiency. It really is time for a rewrite. People seem to be leaning towards a C++ solution but I would rather have Python so we can easily extend it and add new modules.

RE[3]: in some ways, I hate python
by sanctus (2.64) on Sat 15th Sep 2007 17:44 UTC in reply to "RE[2]: in some ways, I hate python"
sanctus Member since:
2005-08-31
Fans: 0

I think it is exacly the point of bnolsen

> IMHO show exactly why scripting languages shouldn't be used too ambitiously for things. They just don't scale well.


When portage was getting more complex, python wasn't the language to do the job anymore. A static typing, compiled language would be better. more error checking and compiled validation.

If you tried to use python application for more than scripting (music player, IDE, etc.) you'll see that as it become more complex, side effect make application unstable (they crash alot). Debuging start to make development no more productive than using compiled language (without pointer).

I develop mainly in python, but sometimes one need to face reality.

RE[4]: in some ways, I hate python
by abraxas (3.48) on Sat 15th Sep 2007 18:25 UTC in reply to "RE[3]: in some ways, I hate python"
abraxas Member since:
2005-07-07
Fans: 0

When portage was getting more complex, python wasn't the language to do the job anymore. A static typing, compiled language would be better. more error checking and compiled validation.

I don't agree. I don't think it was complexity in general but instead portage just wasn't designed well enough to be extended to the degree it has been. This isn't a limitation of Python but a limitation of portage's initial design.

If you tried to use python application for more than scripting (music player, IDE, etc.) you'll see that as it become more complex, side effect make application unstable (they crash alot). Debuging start to make development no more productive than using compiled language (without pointer).

I use PIDA for Python development and it works very well for me. The latest version is very slick and hasn't crashed on me yet. I've also experimented with a few Python music players, like Quod Libet, which haven't caused me any stability issues although I find the interface lacking, which is hardly a complaint against Python.

RE[4]: in some ways, I hate python
by CrLf (2.76) on Sat 15th Sep 2007 20:59 UTC in reply to "RE[3]: in some ways, I hate python"
CrLf Member since:
2006-01-03
Fans: 0

"When portage was getting more complex, python wasn't the language to do the job anymore. A static typing, compiled language would be better. more error checking and compiled validation."

Wait, we are talking about a package manager here, aren't we? Why on earth would a package manager require the extra effort of developing in a compiled language (C/C++) just to get a performance boost? I mean... how can a package manager be performance critical?

I don't know portage, but I would bet the problem is in the design and not in the language... yum used to be _brutally_ slow too, and it is much faster now, even though it keeps being Python. Not downloading tons of crap every time it is invoked helps a lot...

And it's just a package manager...

RE[2]: in some ways, I hate python
by dagw (3.68) on Sun 16th Sep 2007 13:27 UTC in reply to "RE: in some ways, I hate python"
dagw Member since:
2005-07-06
Fans: 2

The problems with portage are more due to design than language. If you where to re-write portage in C using exactly the same design, algorithms and architecture it's currently using, it wouldn't be much faster. Conversly I you where to redesign it from the ground up, and still use python, it would be significantly faster.

RE: in some ways, I hate python
by abraxas (3.48) on Sat 15th Sep 2007 14:52 UTC in reply to "in some ways, I hate python"
abraxas Member since:
2005-07-07
Fans: 0

the first time i ran across python as system scripts was in a fresh gentoo install. it crashed each time i tried to proceed....

You must have had a foobarred installation. I had an issue with python on Gentoo exactly once in the 4 years I have been using Gentoo. Otherwise it is a solid language and other than the slow syncs and slow dependency checking it works fine for portage.

Edited 2007-09-15 14:52

Pry bash (or tcsh) + sed/grep/awk/tr...
by meianoite (3.76) on Fri 14th Sep 2007 23:27 UTC
meianoite
Member since:
2006-04-05
Fans: 10

from my cold dead hands.

renox Member since:
2005-07-06
Fans: 1

While I agree that Python is not a replacement for the shell, your post show the shell's problem: first there is not one shell, but several and the 'script shells' depends on a bunch of tools, all of which have variants depending on the version, OS, etc.

Most script shells are *brittle*, use them on another shell, OS, on file with spaces or weird characters and they break.

What I would like to see is a bunch of tools written in Ruby/Python which would send struct/hash through the pipe: you would have the flexibility of shell and the robustness induced by passing structures/hash around instead of 'hard to parse' text (and if you have to take into account files with weird characters in them, it's really not so easy).

rover Member since:
2005-08-07
Fans: 0

there is not one shell, but several and the 'script shells' depends on a bunch of tools, all of which have variants depending on the version, OS, etc.


That was pretty much the motivation for creating Perl back in the 80s. The situation has improved quite a lot since then. The end of the Unix wars brought a good deal of industry consolidation and the standardization of all those tools. Nowadays it's quite feasible to create shell scripts devoid of this kind of problems.

Even the shell is standardized. POSIX 1003.2 made /bin/sh a KornShell lookalike rather than the historical Bourne shell. That's the only shell you should use for scripts.

But the one true reason to prefer shell scripts is that way you can leverage your knowledge of the command line. Conversely, writing shell scripts will improve your skills in all the standard Unix utilities. Once you start using Perl, Python, etc. you'll have to learn two ways of doing the same thing: One way to do it interactively and one to script it.

japh Member since:
2005-11-11
Fans: 0

Using bash/ksh/nawk/grep etc. is fine for some things. And of course, that's where it should be used.

We have a guy at work who has pretty much the same attitude as you and he insists on doing EVERYTHING in ksh/nawk. He wrote things like XML parsers in nawk (not fully functional, of course, but they almost work for what he needs it for)

In the end, he manages to create slow, error-
prone incomprehensible stuff that would have been fairly simple, fast and easier to make correct in for example python.

So hold on to your bash, but just don't take it too far.

jlarocco Member since:
2005-09-14
Fans: 0

Heh, reminds me of a place I used to work. Their reporting system was kinda like this:

* The server gets a request for report X.
* Server grabs list of environment variables for report X from the DB
* Server sets the environment variables with values passed in the request.
* Server spawns ksh with the appropriate reporting script.
* Shell script uses IO redirection to send SQL to Oracle
* Shell script parses the data and stores it to a temp file.
* The server reads the temp file and sends it back to the client.

The great part is, the guy who actually "designed" that part, left for some other job and nobody else there knew Korn shell.

wirespot Member since:
2006-06-21
Fans: 2

So hold on to your bash, but just don't take it too far.


I think that's exactly what the articles suggests. There's no implying that Python should replace Bash, but complement it for those scripts that are too much for Bash. If anything, it attempts to replace Perl, not Bash.

libray Member since:
2005-08-27
Fans: 1

The great thing about using shell scripts to their maximum capacity is that there are no modules. With perl and python, the suggestion for common use involves a module, which may or may _not_ be on the system.

You will find that once you go down the path of attempting to install a module for an interpreted language, your systems can become out of sync with one another. Not so with shell scripts. A Bourne shell function works as well on one system as it certainly will another.

Even when programming to capture missing modules, have you found that exception use of import (python) or require (perl) involves a lot of alarm bells and whistles. And you do this so that you catch the exception to be able to begin the installation of the module dependencies and module rather than actually getting on with better things to do?

This is like an article I read years ago ...
by Robert Escue (2.04) on Fri 14th Sep 2007 23:28 UTC
Robert Escue
Member since:
2005-07-08
Fans: 6

About using perl for system administration. It comes down to a matter of skill and comfort level with a particular language, and what you are trying to accomplish.

I perfer scripts that run with native shells that do not require an interpreter (sh/ksh/csh) so I can use them in any system as opposed to something I have to install on every box I want to use the script on. The examples shown aren't all that sophisticated, I have seen scripts that do far more freely available from BigAdmin and shelldorado.com.

walterbyrd Member since:
2005-12-31
Fans: 0

>>I perfer scripts that run with native shells that do not require an interpreter (sh/ksh/csh) so I can use them in any systemz<<

But, other than sh, you can't always count on those shells being on any particular system. Especially if it's a windows box.

I used to have the same philosophy, until I started writing 10 line elegant Python scripts, that do more than I could do with 100 lines of clunky shell scripts.

Try Python with easygui, it's amazing. Within minutes you can be writing fairly powerful scripts with a gui interface. The learning curve is nothing.

Robert Escue Member since:
2005-07-08
Fans: 6

I have a few Windows boxes and they host for the most part well behaved applications, our interaction with them is minimal. Our challenges are working with Solaris and Linux using CLI only (no X allowed), but thanks for the tip though! It reminds me of using TCL/Tk.

twocents Member since:
2006-07-30
Fans: 0

I recently rediscovered Rebol (http://www.rebol.com) and giving it a good look over. It's not only able to run on multiple OSes but apps built with it also run on multiple OSes (a ton of them) without recoding.

It's as easy to work with as Python (or arguably moreso) for the beginner (but I'm still evaluating it from that standpoint). It also features built-in GUI (amazingly simple to implement and use) - so there's little need for external help.

The EasyGUI info you provided is great help - thanks! I'm trying to make a decision on a cross-platform scripting language after many years on Win-machines using single-OS only script languages (batches, 4dos, kixtart, Autohotkey, etc..). I'm still leaning heavily toward Python because I know just how easy to use and powerful this language is but this "new" Rebol kid is making it tough:-)

Well of course, it's a scripting language!
by openwookie (1.88) on Fri 14th Sep 2007 23:34 UTC
openwookie
Member since:
2006-04-25
Fans: 1

Many old skool sys admins use perl. I've used ruby for years to tie together both *nix & Windows systems (in addition to using wscript/jscript). It's not surprising that python is well suited to sys admin tasks as well.

drdoug Member since:
2006-04-30
Fans: 0

Actually "Many old skool sys admins" use C, and wonder why people like program run by other programs ;)

Ruby
by Phuqker (2.12) on Fri 14th Sep 2007 23:36 UTC
Phuqker
Member since:
2005-07-17
Fans: 0

I was once a Pythonista, until I discovered Ruby. I've never looked back. If Haskell had better library support, that's what I'd use.

RE: Ruby
by schala (2.24) on Sat 15th Sep 2007 01:39 UTC in reply to "Ruby"
schala Member since:
2006-01-17
Fans: 0

mzscheme makes a better scripting language than you might think.

RE: Ruby
by japh (2.44) on Sat 15th Sep 2007 10:10 UTC in reply to "Ruby"
japh Member since:
2005-11-11
Fans: 0

After using Python for a few years I decided to check out Ruby, and I did look back. Not that Ruby is not a good tool, but I just can't shake that feeling of unease around anything with a syntax that reminds me of perl. ;)

Not quite so fast cowboy
by SEJeff (3.52) on Fri 14th Sep 2007 23:53 UTC
SEJeff
Member since:
2005-11-05
Fans: 7

There is 1 problem with Python as a language for a "Systems Administrator". That problem is that perl is installed by default on ever unix variant under the sun and python isn't.

*nix Administrators use perl. If you are only managing Linux systems or are able to install python on everything, it is certainly easier to develop and debug.

If only pprint was a better equivalent to Data::Dumper, if only.

RE: Not quite so fast cowboy
by jokhva (2.67) on Sat 15th Sep 2007 00:28 UTC in reply to "Not quite so fast cowboy"
jokhva Member since:
2007-09-14
Fans: 0

at least as i know, perl is not default in a FreeBSD install.

RE[2]: Not quite so fast cowboy
by anomie (4) on Sat 15th Sep 2007 17:23 UTC in reply to "RE: Not quite so fast cowboy"
anomie Member since:
2007-02-26
Fans: 0

I believe perl was at one time included as part of the FBSD base installation, but it was removed as it began to bloat (and some other issues).

It's now available as a port.

RE[3]: Not quite so fast cowboy
by estrabd (1.8) on Mon 17th Sep 2007 18:48 UTC in reply to "RE[2]: Not quite so fast cowboy"
estrabd Member since:
2006-01-18
Fans: 0

The last time perl was included by default was 4.x - much of the system scripts that used perl were rewritten in bourne shell..

RE: Not quite so fast cowboy
by Dasher42 (4.56) on Sat 15th Sep 2007 00:37 UTC in reply to "Not quite so fast cowboy"
Dasher42 Member since:
2007-04-05
Fans: 0

There is 1 problem with Python as a language for a "Systems Administrator". That problem is that perl is installed by default on ever unix variant under the sun and python isn't.


Subjectively, I disagree with that style of thinking. As a system administrator, you should know how to work in a minimal environment, yes. But to suggest that you shouldn't avail yourself of a good tool because some vendor doesn't put it in a default install sounds either too narrowly focused on barebones without acknowledging that not everyone wants such a thing, or stagnant. I want neither.

RE[2]: Not quite so fast cowboy
by SEJeff (3.52) on Sat 15th Sep 2007 02:26 UTC in reply to "RE: Not quite so fast cowboy"
SEJeff Member since:
2005-11-05
Fans: 7

Use the best tool for the job. In text processing, perl beats python.

In python, a regexp is a second class object. In perl, a regexp is a first class object. Anyone with proficiency in *both* languages will agree with you.

I love python, but it doesn't make sense for managing "Unix" systems. If the title of the article was, "Why You Should Adopt Python to Manage Linux Systems", I would agree.

You can't always install something as large as python due to business processes or technical requirements. When your company has been managing systems a similar way for 10 years, they might not like to change. (Not reflective of my current job, but true for my previous one.)

Edited 2007-09-15 02:30

RE[3]: Not quite so fast cowboy
by japh (2.44) on Sat 15th Sep 2007 11:05 UTC in reply to "RE[2]: Not quite so fast cowboy"
japh Member since:
2005-11-11
Fans: 0

"In python, a regexp is a second class object. In perl, a regexp is a first class object. Anyone with proficiency in *both* languages will agree with you."

Well, if you consider regexp build into the syntax a better solution, then I guess perl is ahead. I don't find Pythons regexp hard to use and I like the design where you don't cram things like regexp into the language, but keep it in a module.
It will make me type a little bit more, but it also means I usually understand my code better than in perl anyway.

Having said that, I'm not using Python for system administration much. The simple things that I need to do can be done in shell scripts just as well as in Python. The times I use Python is when things should run automatically and a "Permission denied" printed to stderr just isn't enough error handling.

RE[4]: Not quite so fast cowboy
by SEJeff (3.52) on Sat 15th Sep 2007 21:30 UTC in reply to "RE[3]: Not quite so fast cowboy"
SEJeff Member since:
2005-11-05
Fans: 7

Python has exception handling and perl doesn't. You have just hit on an area that Python tromps perl about a millionfold. Python's OO is also not a pain to deal with as it is truly integrated into the language.

That said, Linux systems administration is mostly just dealing with text files and text streams. For that alone, perl will always beat python.

RE[2]: Not quite so fast cowboy
by toomany (2.3) on Sat 15th Sep 2007 09:54 UTC in reply to "RE: Not quite so fast cowboy"
toomany Member since:
2005-11-09
Fans: 0

Yes, it's true. But also is true that some machines doesn't haven't some programs (any program or for a multiple reasons), because customer instructions, environment necessities.
Many years ago back, I used the "joe" editor, until a day said my boss to me; "you would have to be learning to use "vi", because you are going it to have in any UNIX with which you work, whereas the "joe" editor, or a cc (gcc) environment no.

RE: Not quite so fast cowboy
by Vanders (3.28) on Sat 15th Sep 2007 10:59 UTC in reply to "Not quite so fast cowboy"
Vanders Member since:
2005-07-06
Fans: 3

perl is installed by default on ever unix variant under the sun


No it isn't. The idea that Perl is some sort of standard is what drives me (and I suspect quite a few other sysadmins and developers) up the wall.

python !!
by tejaskokje (1.96) on Sat 15th Sep 2007 00:03 UTC
tejaskokje
Member since:
2005-07-18
Fans: 1

What !! I should get a python for my Unix System !! Last time when the world was sane, humans used to manage unix systems. and now we need a python..seems like unix systems are getting wild..

hehe..just kidding

RE: python !!
by theine (2.32) on Sat 15th Sep 2007 12:00 UTC in reply to "python !!"
theine Member since:
2005-09-29
Fans: 0

Dude, that's so lame...

+1 for Perl
by sharyanto (1.07) on Sat 15th Sep 2007 00:34 UTC
sharyanto
Member since:
2005-07-14
Fans: 0

There is 1 problem with Python as a language for a "Systems Administrator". That problem is that perl is installed by default on ever unix variant under the sun and python isn't.


Plus it's harder to write one-liners with Python, with the whitespace requirement and all.

Plus there's no support for writing setuid scripts with Python.

Maybe Python has an edge compared to shell scripts. But I think Perl is much more suited for sysadmins. Its syntax is closer to C and shell, there are more easily available and readily usable modules (i.e. CPAN) than any other languages, setuid support (suidperl, tainted mode), great for one-liners, available by default on most systems, etc.

Unless you're one of the younger ones and have learnt Python and Ruby instead of Perl, then perhaps use that instead of Perl.

RE: +1 for Perl
by mmcgreal (1.77) on Sat 15th Sep 2007 02:02 UTC in reply to "+1 for Perl"
mmcgreal Member since:
2006-09-12
Fans: 0

There is 1 problem with Python as a language for a "Systems Administrator". That problem is that perl is installed by default on ever unix variant under the sun and python isn't.


So, install it.

Plus it's harder to write one-liners with Python, with the whitespace requirement and all.


Seriously, how many times per year do you use a PERL one-liner from the command line? 4? Maybe 5 times?

Plus there's no support for writing setuid scripts with Python.


This is not a safe practice in any interpreted language. Better to write those sections using a compiled language, take your choice.

Its syntax is closer to C and shell...


... and about a dozen other languages and tools. Its syntax is certainly the most expansive syntax of any programming language in history. You might think that's a good thing, but try picking up a piece of code someone else wrote in Perl, and maintaining it.

We have been installing Python on all our Unix boxes for about 5 years now, and I think it was a great move.

ksh93, Python, C. That's all you need for every Unix administrative programming project. And the C is only needed when you need to wrapper a system call into a Python function. They're used in descending order of frequency: ksh93 - 70%, Python - 25%, C - 5%.

RE[2]: +1 for Perl
by netpython (2.44) on Sat 15th Sep 2007 08:57 UTC in reply to "RE: +1 for Perl"
netpython Member since:
2005-07-06
Fans: 6

bash,sed/awk,perl,C fits my bill :-)

RE[3]: +1 for Perl
by Doc Pain (2.76) on Sat 15th Sep 2007 13:10 UTC in reply to "RE[2]: +1 for Perl"
Doc Pain Member since:
2006-10-08
Fans: 6

"bash,sed/awk,perl,C fits my bill :-)"

Sidenote: Don't declare bash as long as you're not using special bash features that are not present in standard sh. sh is the most basal common sense in UNIX scripting. bas isn't (allthough it's very famous in Linux).

Furthermore, I agree to the command set above for most administration tasks that need to be automated. sed and awk are very powerfull, especially when you want to implement "small" tasks with few commands. On the other hand, I like using Python and Ruby for several tasks, but I never thought seriously about using them intensively for administrative tasks. I'll go out and correct my attitude. :-)

RE[4]: +1 for Perl
by Geoff Gigg (2.2) on Sat 15th Sep 2007 15:23 UTC in reply to "RE[3]: +1 for Perl"
Geoff Gigg Member since:
2006-01-21
Fans: 0

I tried to take that route when converting a major system from Unix to Linux. The Unix system used Posix shell, and I thought the best approach would be to use bash with the Posix compliant switch turned on. Unfortunately, that was too limiting. There were several key features that were not present in the bash sh mode but did have an analogue in plain bash. Plus the fact that most Linux stuff was set to run bash by default, it meant I was continually having to be very sure what I was mixing. I finally bit the bullet and converted every script to bash. I guess I could have taken another approach, but this was more direct and made me happier in the long run.

(Not to mention that there are all sorts of other incompatibilities between Unix and Linux utilities that had to taken care of.)

I used C when required for speed or library calls, but no other scripting language. I did not want to introduce another tool unless absolutely necesary. Shell script can be verbose, but it can also be very nicely formatted and readable if you take the time.

If had to do it over again without the time constraints, maybe I would have chosen a scripting language to make it more portable in the future. But time always forces a less than ideal solution!

RE[4]: +1 for Perl
by CrLf (2.76) on Sat 15th Sep 2007 20:50 UTC in reply to "RE[3]: +1 for Perl"
CrLf Member since:
2006-01-03
Fans: 0

"Sidenote: Don't declare bash as long as you're not using special bash features that are not present in standard sh. sh is the most basal common sense in UNIX scripting. bas isn't (allthough it's very famous in Linux)."

That doesn't work if you are developing your scripts in Linux (where "/bin/sh" is usually just a symlink to "/bin/bash"). You end up thinking your scripts can run in the standard bourne shell when they actually don't.

If you want portability, just use "/bin/ksh". It's mostly compatible with bash (so you can use advanced features without having to relearn syntax) and it's available by default in most other unixes. In Linux, if it isn't installed by default it's usually an "apt-get install" or "yum install" away, so not a big deal.

RE[3]: +1 for Perl
by CrLf (2.76) on Sat 15th Sep 2007 20:40 UTC in reply to "RE: +1 for Perl"
CrLf Member since:
2006-01-03
Fans: 0

"Seriously, how many times per year do you use a PERL one-liner from the command line? 4? Maybe 5 times?"

And the fact that 99.9% of perl one-liners result from people not knowing how to use "sed" and "grep".

RE[4]: +1 for Perl
by dagw (3.68) on Sun 16th Sep 2007 13:33 UTC in reply to "RE[3]: +1 for Perl"
dagw Member since:
2005-07-06
Fans: 2

Actually I find 99.9% of perl one-liners result from perl nerds trying to show off, and prove that it can be done.

shell > python
by whartung (3.6) on Sat 15th Sep 2007 00:45 UTC
whartung
Member since:
2005-07-06
Fans: 0

There's a prime benefit to working with shell scripts over a dedicated scripting language.

Basically, at their core, shell scripts can be little more than "watch me" macros ala Excel or Word.

You take the stuff you normally type in to the shell, and instead put them in a file.

That means you can easily incrementally develop your tasks through the rich Unix command set, and, over time, record those tasks in the form of a shell script for posterity and easier automation.

Frankly, pipes are just terribly handy and easy to use. And the rich command set simply empowers the capabilities given to us by pipes.

Dropping down in to a scripting language (Whether python, perl, or anything else), means that you have to completely rethink the process. You're now working with very fine bits of data (like lines and characters) rather than big chunks (like files and directories).

The closest thing I've seen to a decent combination of scripting language and shell environment is scsh, the Scheme shell.

It's essentially a full boat scheme interpreter but built and designed to be used as a full time shell. So, it interacts well with generic unix command line programs, has pipes, background jobs, command line editing and history, etc.

But you also have all the power of Scheme to dance with at the same time, so you don't have to sacrifice power or expressibility while working with and knitting together command line programs to get stuff done.

If you happen to use Python or Perl as your shell, then that makes scripting your daily tasks that much easier, for the same reason that shell scripts work. That's what make scsh nice, because you are supposed to live in the shell day to day, not pop in and out like you would with a normal scripting language.

But I don't think that Python or Perl make particularly good shells.

so modern
by _df_ (1.72) on Sat 15th Sep 2007 00:51 UTC
_df_
Member since:
2005-07-06
Fans: 0

if you work at my place, you have to know how to sysadmin _ancient_ hpux unix boxes, no way would python ever pass clearence to be installed, certification is a nightmare. no perl no nothing.

modern unix would be a wet dream. my industry doesnt move fast enough, when something is in production, its frozen.

I see
by Oliver (3.08) on Sat 15th Sep 2007 01:23 UTC
Oliver
Member since:
2006-07-15
Fans: 5

Why you should worship KISS as administrator would be an far better article.

Good link
by Joe User (0.88) on Sat 15th Sep 2007 01:44 UTC
Joe User
Member since:
2005-06-29
Fans: 1

How to Think Like a Computer Scientist: Learning with Python
http://www.ibiblio.org/obp/thinkCSpy/

RE: Good link
by i3X171UM (4.32) on Sat 15th Sep 2007 01:47 UTC in reply to "Good link"
i3X171UM Member since:
2005-08-12
Fans: 4

Why is he getting modded down? It's a good Python tutorial.

RE[2]: Good link
by Joe User (0.88) on Sat 15th Sep 2007 01:55 UTC in reply to "RE: Good link"
Joe User Member since:
2005-06-29
Fans: 1

I'm modded down by the OSNews system by default because I'm considered a troll (even if most of the times my input is valuable). Telling the truth or not thinking like the mainstream is not a good thing.

Another series of articles from SysAdmin Mag:
by walterbyrd (3.8) on Sat 15th Sep 2007 02:06 UTC
walterbyrd
Member since:
2005-12-31
Fans: 0

Here is the start to a series of six articles about "Python in Systems Administration."

http://www.samag.com/documents/s=8964/sam0312a/0312a.htm

Fairly informative, worth reading.

Also, I think O'Reilly is publishing a book about Python in sys admin next year.

Comment by bnolsen
by bnolsen (2.24) on Sat 15th Sep 2007 02:20 UTC
bnolsen
Member since:
2006-01-06
Fans: 0

Heh, emacs/vi, kde/gnome
now there's perl/python/ruby/add your own here....

I personallly really used to like ruby until I ran into IO and started asking myself: how complex should a langauge really be?

Python is for wimps!
by BSDfan (2.72) on Sat 15th Sep 2007 03:19 UTC
BSDfan
Member since:
2007-03-14
Fans: 2

Real men, (Or woman..) do things manually ^_^

RE: Python is for wimps!
by SEJeff (3.52) on Sat 15th Sep 2007 03:48 UTC in reply to "Python is for wimps!"
SEJeff Member since:
2005-11-05
Fans: 7

Granted I'm a 'nix guy, but the idea of ClusterRdesktop (for windows) would be really cool as an equivalent to something like clusterssh on Linux.

RE: Python is for wimps!
by WereCatf (4.12) on Sat 15th Sep 2007 10:24 UTC in reply to "Python is for wimps!"
WereCatf Member since:
2006-02-15
Fans: 7

Real men, (Or woman..) do things manually ^_^

Umm, no. We women are smart enough to leave such things to "real men" ;P

v Ruby
by asdx24 (2.48) on Sat 15th Sep 2007 03:22 UTC
RE: Ruby
by sbergman27 (3.92) on Sat 15th Sep 2007 04:34 UTC in reply to "Ruby"
sbergman27 Member since:
2005-07-24
Fans: 35

Please stop. Comments like that, which are all too common, make the Ruby community seem like a bunch of teenagers.

Rarely do I see comments like "Python Rulezzzzz!" in Ruby-related threads. But, for whatever reason, some Ruby fans just can't resist getting childish when the topic of Python comes up.

I *prefer* Python. It's a great language. But I choose not to trumpet the fact in Ruby-oriented threads, because I feel that it would be in poor taste, and would not be constructive.

v RE[2]: Ruby
by adkilla (1.5) on Sat 15th Sep 2007 06:23 UTC in reply to "RE: Ruby"
RE[3]: Ruby
by japh (2.44) on Sat 15th Sep 2007 10:15 UTC in reply to "RE[2]: Ruby"
japh Member since:
2005-11-11
Fans: 0

Now you're just being silly. ;)

RE[4]: Ruby
by Doc Pain (2.76) on Sat 15th Sep 2007 13:12 UTC in reply to "RE[3]: Ruby"
Doc Pain Member since:
2006-10-08
Fans: 6

"Now you're just being silly. ;) "

That's not silly. That would be silly:

C:/MICROS~1/SYSADMIN/QBASIC.EXE ruhletzzzz!!! :-)

Python for Unix System administration
by sbergman27 (3.92) on Sat 15th Sep 2007 04:41 UTC
sbergman27
Member since:
2005-07-24
Fans: 35

Interestingly, in "The Python Cookbook" most of the examples of Python's use in system administration are for Windows. The authors comment about that at the beginning of the chapter. It seems that the power of shell script eclipses Python's usefulness in that area in the Unix/Linux domain. It has less competition in a Windows environment.

As much as I like Python, I must admit that for most system administration uses, shell script, ugly as it is, is much more straightforward and convenient most of the time.

Depends on your set-up
by danieldk (4.12) on Sat 15th Sep 2007 11:40 UTC
danieldk
Member since:
2005-11-18
Fans: 2

There is a lot of bickering about Python here, suggesting that real system admins use Perl or shell. But it completely depends on the system that you are administrating. E.g., on RHEL and related systems (Fedora, CentOS, etc.), *a lot* of tools are written in Python. As a result, there are very good bindings from everything from Xen/libvirt via kickstart to yum/RPM.

As a result, you can automate stuff like VM deployments with only a few lines of code. And in contast to e.g. running virsh from a shell scripts, you can interpret all the return values/exceptions, etc. in a sane way.

Just to give some slight examples. This script was used to demo Xen at LinuxTag:

http://people.centos.org/~daniel/code/event-demos/instloop/xenloop-...

As you can see, one can easily create/destroy virtual machines in a controlled manner. Very handy if you want to build custom tools for your VM setup. Another example is the yum priorities plugin. I wrote it about a year ago, because I use some non-official repositories, and I wanted to tweak yum to avoid overriding packages from high-priority repos with packages from low-priority repos:

http://devel.linux.duke.edu/gitweb/?p=yum-utils.git;a=blob_plain;f=...

There is *no* way this could have been done easily with Perl or shell scripts, while it eases up system administration considerably.

Of course, this doesn't apply to systems that don't use Python for their administration tools/libraries. Python, Perl, or shell scripts can all be excellent system administration tools, but often the most comfortable tool is dictated by the systems that are in use.

Edited 2007-09-15 11:42

Wake me when
by sorpigal (2.84) on Sat 15th Sep 2007 12:28 UTC
sorpigal
Member since:
2005-11-02
Fans: 0

Wake me when there's a pysh, a python shell.

Like any sysadmin I will always use the best tool for the job. Since I'm in bash most of the time it is often best to hack a quick one-liner or small script to do what I need. If I am mostly running other programs this also makes sense. I will resort to perl for added functionality I can't get with existing tools... and then inevitably invoke my perl script from within a shell script.

This held true even when I worked in the perl shell.

Python is no different. If you want me to write in python what I now do with shell scripts, I want a python shell. For everything else I'll just write a python program which I will use from a shell script.

RE: Wake me when
by japh (2.44) on Sat 15th Sep 2007 13:45 UTC in reply to "Wake me when"
japh Member since:
2005-11-11
Fans: 0

"Wake me when there's a pysh, a python shell."

Okay then. Wake up!
http://pysh.sourceforge.net/
http://sourceforge.net/projects/pyshell/

But I agree with the pysh author, it probably isn't the right way to go.

The reason not every unix system has Python, or even perl installed is that the tools that are available are doing a pretty good job for most simple automation tasks.

Just as the reason Microsoft made PowerShell is that the tools on that platform didn't really do a good job at all kind of simple automation tasks.

RE: Wake me when
by marcell (1.63) on Mon 17th Sep 2007 00:04 UTC in reply to "Wake me when"
marcell Member since:
2005-07-11
Fans: 0

http://ipython.scipy.org/moin/

IPython is a multiplatform, Free Software project (BSD licensed) that offers:

* An