Skip to main content

Automatically created environment for python package

Project description

cronvice

maintain your programs running under SCREEN using AT job scheduler

Example

 # example
cronvice --help

Installation

# you need the scheduler
# sudo  apt install at # NOT HERE
sudo apt install crontab
# you nee the code (anti PEP 668 way)
pip3 install cronvice

All scripts must be in ~/.myservice/anyname/tag

  • where ~/.myservice is the S-PATH, path to scripts structure
  • anyname - can be number of different subfolders
  • tag must be a executable script with a uniqe name in all ~/.myservice
  • ~/.config/cronvice/cfg.json - contains the S-PATH ("services")
  • without a parameter, interactive tui is run, quit it with .q

Usage

Harmless calls

cris l
cris t syncthing
cris p syncthing
cris c syncthing

Enter to screen enviroment when running

cris e syncthing
  • r(un)
  • a(dd)
  • d(elete)
  • e(nter)
  • c(omment show)
  • t(ime show)
  • p(ath show)
  • l(ist cron)
  • x (block service call with impossible timestamp)

Important services

PI

  • inet/apswitch
  • inet/piaddr.py
  • warning/lowdisk
  • hwdevs/tele012ntc (technic)
  • image/flashcam8000
  • image/flashcam5000

BUGS

  • crashes when no crontab defined
  • DATE MUST BE `Sat 12 Apr 17:09:55 CEST 2025`
    • NOT `Sat Apr 12 15:09:39 UTC 2025`
    • use install.me script to repair

Appendix

these are comments for using uv and uvx.... this is new stuff

New workflow with environments

Workflow

  • ./distcheck.sh (no pip3 inside)

    • if twine{.verbatim} not present, uv tool install --force twine
    • same with uv tool install --force bump2version
  • uv tool install --upgrade cronvice and if hidden errors:

    • uv tool install --upgrade cronvice==0.1.31 force to reveal
  • NEVERTHELESS, environment is needed

    • make ~/.venv
    • cd ~/.venv
    • uv venv myservicenv and it is in this user folder.
    • ANY USE NEEDS source ~/.venv/myservicenv/bin/activate
    • All stuff needs to be installed via uv: like uv pip install fire
    • When all is installed, source ...activate is run before python call
      • which works for tele01 that calls te01.py
      • that has normal shebang
  • PROBLEM for influx_chrony

    • no idea now...
  • NO PROBLEM telegrf, only telegraf needs to get installed

    Using local venv is even better

    uv venv creates local .venv in the project, see more and more about lock

Hybrid shebang

two cases with different environemnts are hard

#!/bin/bash
#myservice_description: disk and ntp to INFLUX

"""" 2>/dev/null
# BASH CODE STARTS HERE

echo "Hello world from Bash!"
sleep 1
if [ -e "$HOME/.venv/myservicenv/bin/activate" ]; then
 source  $HOME/.venv/myservicenv/bin/activate
 echo i... myservicenev is activated
else
 echo i... not activated
fi
sleep 2
# BASH CODE ENDS HERE
/usr/bin/env python3 $0
exit
"""


#Python code goes here
"""
...
PEP668  UV UVX.... I dont know how to use environment....
"""
import fire
import subprocess as sp
import socket

if __name__=="__main__":
    fire.Fire( main )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cronvice-0.1.60.dev0.tar.gz (41.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cronvice-0.1.60.dev0-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

Details for the file cronvice-0.1.60.dev0.tar.gz.

File metadata

  • Download URL: cronvice-0.1.60.dev0.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for cronvice-0.1.60.dev0.tar.gz
Algorithm Hash digest
SHA256 8576b970f9ea8d0b02b152dce41ad692a969c4dc136fc3f48398be38f013921f
MD5 ae073f337ba605b3db5348f3d71e40d4
BLAKE2b-256 0ac360cea334445abf36783e61d554b0021de5370ec3d43f08d8befdfd2aa8e0

See more details on using hashes here.

File details

Details for the file cronvice-0.1.60.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for cronvice-0.1.60.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 4540d652a7e2d0b9bca8a82db58bfe2c6c73ffcc3a1b06cd5e65cdde37d972cf
MD5 2979b55ae65f4d607b20221678cac6d7
BLAKE2b-256 542d44fc2a447b4443765ae7b8fc4408b0fc3aa2047dafece1eec0dd96958e9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page