Python a good thing for sysadmins ?

Alex Martelli aleax at aleax.it
Fri Sep 7 05:49:57 EDT 2001


"Aurelien" <aurelien at fractals.be> wrote in message
news:mailman.999803829.7639.python-list at python.org...
    ...
"""
I'd like to know if Python could be used for system administration. And
if there are people out there who use it for that. I noted for instance
"""
Sure.  For example, python is just about the only non-core
package I've added to my OpenBSD router/firewall machine (I
carefully refrained from putting X on it, for example -- the
fewer pieces are there, the fewer can break), because I would
hardly know how to live with it for system administration
(yeah, yeah, sure, I _can_ hack bourne or korn shell, but,
do I really *WANT* to?!-).

"""
Could it be used for example to launch tasks from the cron daemon ?
"""
Sure, why not?  Just mark the Python script as executable,
start it with
    #!/usr/local/bin/python2 -OO
(or whatever, depending on your python's installed location
and name), and then use the script just as you would for any
other script or executable (except, of course, and just like
for all scripts, *DON'T* make it setuid -- in OpenBSD, or
with any other posix-compliant cron/crontab subsystem, you
just put the executable e.g. in /var/cron/tabs/fleep, by
running "crontab -u fleep thecrontabfile", and the stuff in
it is automatically run as user fleep).
Maybe I'm not really understanding your question...?


Alex






More information about the Python-list mailing list