Schedule your Python scripts
Project description
pycronscript
Schedule your Python scripts.
Getting started
Install package
pip install pycronscript
Create config file
This is created with the first run of pycronscript
and you can see the path where it is has been created.
Register your scripts for the scheduled run in config file
Note: Scripts must have a 'run' method!
[custom_name]
path=/home/my_user/foo/bar/my_script.py
each={'minutes': 5} # datetime.timedelta args, but in dict format. Default=1h.
...
Start
Run again pycronscript
Getting started with Docker (example)
Files needed:
pycronscript_with_docker
├── config.cfg
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
└── test.py
test.py
def run():
print('working!')
config.cfg
[test]
path=/usr/app/src/test.py
each={'minutes': 5}
Dockerfile
FROM python:3.11
WORKDIR /usr/app/src
RUN pip install pycronscript
RUN mkdir -p /root/.config/pycronscript
COPY config.cfg /root/.config/pycronscript/config.cfg
# Install your custom requirements
COPY requirements.txt ./
RUN pip install -r requirements.txt
# Copy scripts
COPY test.py ./
docker-compose.yml
version: '3.4'
services:
pycronscript:
build: .
container_name: pycronscript
entrypoint: 'pycronscript'
restart: always
Start
docker-compose up -d
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
pycronscript-0.9.4.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file pycronscript-0.9.4.tar.gz
.
File metadata
- Download URL: pycronscript-0.9.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d710ad341df04385215fdaf22389b87ea71d155f051b421388138889717c22c |
|
MD5 | fcd63c3f3f72bd908a2771a5fce395d6 |
|
BLAKE2b-256 | 4a9b2f5661fdf462d7123e4de784190368053f467697bc62bcf6c4cba30c5378 |
File details
Details for the file pycronscript-0.9.4-py3-none-any.whl
.
File metadata
- Download URL: pycronscript-0.9.4-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06be4e3c70dabc17edac8cbde83ec8336f137bfca642c5c573d6c17ea174752e |
|
MD5 | 6c3441723f30d48eacb965aaac2acef9 |
|
BLAKE2b-256 | fb62a086ac02db405e07d9051f410a1ae02baef5429e5b1600a410b11770a311 |