2

Lest I reinvent the wheel .... again:

Is there a python interface, API or module for the standard linux "at" task scheduler? I have tried searching the internet but searching for the word "at" is a tad bit useless :-)

My intention is to have a python script process same data and construct a shell file. Then use a subprocess call to have "at" schedule the job file for a specific date and time. I will have a similar function using "Schtasks.exe" if python detects it is running on windows. Lastly the python script exits ... leaving system scheduler the responsibility of running the job file.

update 1 July 2019: Found an interesting "at" quirk. The file called on the "at" command line (i.e. the script or shell file) does not need to be marked as "executable" in order to be run by "at".

For the record: I am running Linux Mint 19.1

hlovdal
  • 23,353
  • 10
  • 78
  • 148
LewTwo
  • 63
  • 7
  • Some options: `schedule`, `Celery` – Brad Solomon Jun 26 '19 at 20:39
  • standard module [sched](https://docs.python.org/3/library/sched.html), external modules [schedule](https://schedule.readthedocs.io/en/stable/), [APScheduler](https://apscheduler.readthedocs.io/en/latest/) – furas Jun 26 '19 at 20:46
  • I believe "schedule" would require the python script to be up and running 24/7. I would prefer to use the scheduler already built into the system. – LewTwo Jun 26 '19 at 20:47
  • previous_comment = previous_comment.replace ("schedule", "all of the above") – LewTwo Jul 01 '19 at 15:28

1 Answers1

1

You can achieve this with different approach:

  • Write your python script.
  • Call this script with a bash file.
  • Schedule bash file with a crontab task.
mahmutoflaz
  • 368
  • 3
  • 9
  • 2
    My principle objection to cron is that "cron -e" invokes the system editor which is some incarnation of "vi" or "nano". Lastly cron is good for repeating tasks but running on a specific date is a bit cumbersome. "at" is much more suited for that. – LewTwo Jun 26 '19 at 20:53