[Tutor] Simple Linux Admin1, New guy looking for some tips.

Joshua Banks syn_ack at comcast.net
Sat Feb 7 01:21:23 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Sorry, I hope my long windedness doesn't scare you away from reading my 
thread. :)

As I read, read, and re-read through allot of the python tutorials I'm 
finding some stuff is starting to sink in. Its only been a few days so 
I don't expect miricales.  Putting Python to work is another story 
though. Heh. Heh.

I have an idea of some of the simple linux admin things that I would 
like to do with Python. What I'm not finding is tutorials based on 
using python to do simple linux admin tasks. 

Maybe I shouldn't say "admin" I only use acouple of Gentoo linux 
machines on my local network. In an effort to best facilitate the way 
that "I learn" am asking for some help as well as any links that are 
geared towards using Python for some of the simple linux admin tasks 
with explanations of what the python code is doing from step A to Z 
when scripting those said tasks. Googling finds some stuff here and 
there but nothing with explanations or Python linux tutorial driven I 
guess.
"As soon as I gain some more experience I plan on creating my own 
mini-Python linux tutorial for newbies like myself"

In the mean time I would like to take some really small baby steps and 
put forth a few simple examples of the "admin" thingee's that I'm 
referring too and start learning. 1 example for now anyways.





Example:........(And I know that this can be done very simply using 
other means besides Python)

.......Everytime that Gentoo linux compiles a package there's a log file 
created of that said compilation for each package compiled. If a 
package breaks or fails I can reference that specific log and try and 
find out where it failed or broke or what caused the problem. These are 
also nice to have if an engineer would like to see them. These specific 
logs are stored in "/var/log/portage directory"

This directory is going to become very big, fast.

"ls -la in the /var/log directory shows portage with:"
drwxrwsr-x    2 root     portage      4872 Feb  5 08:16 portage

root at fusion1 log # du -ah
7.1M    ./portage

Since these logs are "only occasionally" used for referencing I would 
like to compress all the log files in this directory when seen fit and 
have a subdirectory created in the "parent portage" directory to store 
compressed files. Kinda like a "Portage log Archive" I guess.





So hopefully the following is a good starting baby step to learning some 
Python.  :P

Specifically, I would like to accomplish the following with a Python 
script.

1) Compress all files located in "/var/log/portage/" (not sure which 
compression utility is the best for this case)

2) Create a subdirectory located within the Parnet "portage" directory 
called "LogArchive", and place the compressed files from the "portage" 
directory into newly created subdirectory "LogArchive".

#My Mental note: I would preferably like to compress all files together 
if possible instead of individually. Not sure how that is best done 
though. Maybe thats directory compression... Hmmmm.. never done that 
before.

How do I do this with Python considering "#My Mental note:"? I will use 
this example as a building point instead of jumping into the wxPython 
stuff that my brother keeps trying to push on me.. I just don't want to 
learn the GUI stuff until I feel alot more comfortable with Python 
basic's. Concepts and Symantics.

Thanks bunches. :D

Joshua Banks
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAJIPjp9X7q/XgeyYRAsMjAJ9jnn5Jqa5R6CRnzEtxgx3CpnqyLwCgkABX
kbrLIzF/5l+NokiHAyHOZ1I=
=1cLE
-----END PGP SIGNATURE-----




More information about the Tutor mailing list