I use at
to schedule jobs and atq
to display the scheduled jobs. But it mildly irritates me in that I have to look up each job individually. I wrote a Python script to display the scheduled job under the scheduled time.
(In my world all the commands will begin 'task')
So instead of
stafflinux$atq 8 Mon Aug 18 09:00:00 2014 a joseph 10 Tue Aug 19 09:00:00 2014 a joseph 15 Thu Aug 21 09:00:00 2014 a joseph 12 Fri Aug 22 09:00:00 2014 a joseph 9 Thu Aug 21 09:00:00 2014 a joseph 14 Sat Aug 30 09:00:00 2014 a joseph 7 Sun Aug 17 09:00:00 2014 a joseph 6 Mon Aug 18 09:00:00 2014 a joseph 11 Sat Aug 30 09:00:00 2014 a joseph stafflinux$
My script produces
stafflinux$./atscript.py 8 Mon Aug 18 09:00:00 2014 a joseph task "buy a four-way plug adapter" task "see guy about meeting" ----------------------------------------- 10 Tue Aug 19 09:00:00 2014 a joseph task "bring back personal effects from office" ----------------------------------------- 15 Thu Aug 21 09:00:00 2014 a joseph task "book tickets for next week" -----------------------------------------
I'm looking for any feedback - particularly in terms of 'pythonic' style and any and all tricks I may have missed:
#!/usr/bin/python
import os
os.system("atq > attemp.txt")
file = open("attemp.txt")
line = file.readline()
while line:
number =line[:2]
print line.strip()
os.system("at -c "+ number+ "| grep task")
line=file.readline()
print '-----------------------------------------'
print line
os.system("rm attemp.txt")