File: crontest

package info (click to toggle)
python-crontab 1.8.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 356 kB
  • ctags: 494
  • sloc: python: 1,520; makefile: 8; sh: 8
file content (27 lines) | stat: -rwxr-xr-x 518 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python

import os
import sys

args = sys.argv[1:]
user = None

if '-u' in args:
    user = args[args.index('-u')+1]

if user == None:
    sys.stderr.write("no crontab for nouser\n")
    sys.exit(1)

if '-l' in args:
    if not os.path.exists('data/%s.tab' % user):
        user = 'user'
    fhl = open('data/%s.tab' % user, 'r')
    print fhl.read()
else:
    for a in args:
        if a[0] != '-' and a != user:
            # We could save the crontab here, but not right now
            pass

sys.exit(0)