Giter Club home page Giter Club logo

pxalarm's Introduction

description

pxalarm is a simple POSIX sh script that periodically checks a config file and executes commands at specified times.

installation

  • Alpine
apk add pxalarm
  • Others
curl https://raw.githubusercontent.com/iruzo/pxalarm/main/pxalarm -o pxalarm

usage

  1. Create a config file or configure a custom path for your config file:
  • Default config file paths are $XDG_CONFIG_HOME/pxalarm/config and $HOME/.config/pxalarm/config.
  • You can set a custom path with -c like so:
./pxalarm -c '/your/new/config/file'
  1. Set your alarms in that file with the following format:
[YYYY-mm-DD HH:MM u q] command
  1. Launch the program with the following command. It will check the config file every minute. The -d command-line argument will cause the program to run unattended in the background as a daemon. You can also omit -d to run it in the foreground, if you want to see the logs for example.
./pxalarm -d

Note: The program will continue to run in the background (if the -d flag was passed) and check the config file every minute until stopped. You can stop it at any time by running pkill pxalarm, or by pressing Ctrl-C if it is running in the foreground.

config file

Time can be replaced with * to match any time. The following formats are supported:

# YYYY: 4-digit year
# mm: 2-digit month
# DD: 2-digit day
# HH: 2-digit hour (24-hour format)
# MM: 2-digit minute
# u: weekday (1 for Monday, 2 for Tuesday, ..., 7 for Sunday)
# q: quarter of year (1, 2, 3, 4)

[YYYY-mm-DD HH:MM u q] command            # command will be executed at that specific moment if that day is u and quarter of year is q.
[*-mm-DD HH:MM u q] command               # command will be executed every year at that specific moment if that day is u and quarter of year is q.
[YYYY-*-DD HH:MM u q] command             # command will be executed every month of YYYY at that specific moment if that day is u and quarter of year is q.
[YYYY-mm-* HH:MM u q] command             # command will be executed every day of that month at that specific moment if that day is u and quarter of year is q.
[YYYY-mm-DD *:MM u q] command             # command will be executed every hour at minute mm of that day if that day is u and quarter of year is q.
[YYYY-mm-DD HH:* u q] command             # command will be executed every minute of that hour on day u and quarter of year q.
[YYYY-mm-DD HH:MM * q] command            # command will be executed at that specific moment every day on the quarter q of the year.
[YYYY-mm-DD HH:MM u *] command            # command will be executed at that specific moment on day u, no matter the quarter of year.
[*-*-* *:* * *] command                   # command will always be executed every minute.

pxalarm's People

Contributors

iruzo avatar stonks3141 avatar nullishamy avatar

Stargazers

Sheldon Rupp avatar  avatar lemon avatar alaska avatar  avatar ebigram avatar  avatar  avatar Thomas Lagies avatar Steven Evans avatar  avatar

Watchers

 avatar  avatar

Forkers

nullishamy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.