Python a good thing for sysadmins ?

Chris Barker chrishbarker at
Thu Sep 6 23:48:51 CEST 2001

Aurelien wrote:

> I'm new here and for one good reason: I don't know Python, and I'd like
> to know more :-)

As good a reason as any...
> 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. 

It sure can, and we sure do...

> Could it be used for example to launch tasks from the cron daemon ?

Absolutely: as an example, I wrote a little Python script that tars up a
CVS server archive, and then FTPs it over to an FTP server for backup. A
pretty primitive way to do a backup, but it works. It gets called by
chron every night. Here it is:

#!/usr/bin/env python
from ftplib import FTP
import os
SERVER = FTP('ftpserver','username','password')
file = os.popen(' tar czf - home/CVS')
SERVER.storbinary('STOR CVS.tgz',file,1024)

You can use os.system, popen, exec*, fork, etc. to launch other

Note that Python is overkill for many simple tasks, you should probably
stick with shell scripting for the simple stuff. However, if you are
like me, you can only keep a few languages in your head at a time, so
you may want to use Python for everything.


Christopher Barker,
ChrisHBarker at                 ---           ---           --- ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------

More information about the Python-list mailing list