pyatcron-devel-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Comments on the diagram(was:RE:[Pyatcron-devel-list]Cronbackend: a c


From: Childers, Matthew
Subject: RE: Comments on the diagram(was:RE:[Pyatcron-devel-list]Cronbackend: a correction)
Date: Wed, 19 Nov 2003 15:37:22 -0600

>Normally, we would only include the crontab of the user running
pyatcron, right? Do we want to implement >something where if root runs
pyatcron, he/she could view all of the other user's crontabs as well? If
so, we >would need two ways of doing it. First, since /var/spool/cron is
only readable by root, to get the crontab of the >user running the
program, we would do something like this:
>
>import commands
>
>entries = commands.getoutput('crontab -l').split('\n')[3:]
>
>This brings in each cron entry into a list ( the [3:] makes sure we
don't get those first three lines that are >just comments about the
crontab, etc.) Then, we can just parse through it, making it more "human
readable" so >that the tasklist will display when the job(s) run.
>
>If it's root running it, and we want him/her to view all users
crontabs, we would have to parse the actual files >in /var/spool/cron
for each user:
>
>cronfile = file('/var/spool/cron/<user>', 'r')
>entries = cronfile.readlines()[3:]
>
>I was playing around with this last night (as you can tell) trying to
figure out whether to make each entry its >own object, or just leave
them as lists. What do you all think?
>Also, as I don't know as much about GTK, how would we output the
entries into the tasklist ListStore in >mainwin.py ??? 

We should just be able to loop through them and add them to the
listStore.  This was some of the first code I wrote, look at the top of
the PyatCron class.  Ignore the whole class structure, but adding the
entries ListStore code should be good.

Attachment: mainwin.py
Description: mainwin.py


reply via email to

[Prev in Thread] Current Thread [Next in Thread]