Periodic task with timezone
Project description
Periodic task with timezone
#!/usr/bin/env python3
import logging
import os
from periodtask import TaskList, Task
from periodtask.mailsender import MailSender
logging.basicConfig(level=logging.INFO)
send_success = MailSender(
os.environ.get('EMAIL_HOST'),
int(os.environ.get('EMAIL_PORT')),
os.environ.get('EMAIL_FROM'),
os.environ.get('EMAIL_RECIPIENT'),
).send_mail
tasks = TaskList(
Task(
name='test',
command=('ls', '-al'),
periods='* * * * * Europe/Budapest * 0',
run_on_start=True,
mail_success=True,
send_mail_func=send_success,
),
Task(
name='test',
command=('cat', 'README.rst'),
periods='* * * * * Europe/Budapest * 0',
run_on_start=True,
mail_success=send_success,
)
)
tasks.start()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
periodtask-0.5.0.tar.gz
(8.7 kB
view details)
File details
Details for the file periodtask-0.5.0.tar.gz
.
File metadata
- Download URL: periodtask-0.5.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a9cd02de1bbbc6e2a3644221eaceb4d9946d6851c59bfbd8f07ef857c58e3b8 |
|
MD5 | 0818a0ed9aae8d0db10725897468f4ff |
|
BLAKE2b-256 | 48ee12b83e14609de7726586d1490e0efd8163794a5bf28da87dc1999ad16834 |