File: cronfiller.py

package info (click to toggle)
cron 3.0pl1-162
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,204 kB
  • sloc: ansic: 47,007; perl: 733; makefile: 429; sh: 425; python: 36
file content (19 lines) | stat: -rwxr-xr-x 537 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/bin/python3
# this program can be used as a special editor. Example:
# EDITOR=$(pwd)/confiller.py crontab -u dummy -e
# this file is a dependency of the test check_significant_header

import sys
import time

# get the data from the crontab
with open(sys.argv[1]) as infile:
    lines = infile.read()
# add a new line to the crontab
lines += "* * * * * /bin/ls\n"

# wait just a short time to ensure that the crontab file will be
# correctly managed.
time.sleep(1)
with open(sys.argv[1], "w") as outfile:
    outfile.write(lines)