Skip to content

Fuck the fact that the number of days in a week is prime

License

Notifications You must be signed in to change notification settings

UlyssesZh/peroutine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

peroutine

Remind you of periodical events. The period can be any positive integer of days. (Work around the fact that the number of days in a week is prime!)

Installation

Install Ruby, and then put the peroutine file in a directory in your $PATH. Remember to add execution permission to the file.

Usage

First, run peroutine edit to edit the configuration file. Here is a sample configuration file:

---
- description: Wash hair
  period: 2
  on_command: 'curl -H "Title: Wash hair" -d "Wash your hair today." https://ntfy.sh/peroutine'
  off_command: 'curl -H "Title: Don''t wash hair" -d "Don''t Wash your hair today." https://ntfy.sh/peroutine'
  on_time: 23
  off_time: 23
  one_date: 2022-12-05
- description: Wash clothes
  period: 8
  on_command: 'curl -H "Title: Wash clothes" -d "Wash your clothes today." https://ntfy.sh/peroutine'
  on_time: 9
  one_date: 2022-12-06

The configuration file is a list of periodical events. The period is specified as the number of days. The on_command and off_command are the commands to run when the event is on or off today. The on_time and off_time are the times to run the commands. The one_date is one date when the event is on.

The description, period, and one_date are required. Other fields are optional.

You can run peroutine list to see all the events, grouped by the status (on or off today). For example, with the above configuration file, the output of this command on 2022-12-05 is:

On today:
Wash hair

Off today:
Wash clothes

The peroutine cronjob command runs the on_command and off_command specified in the configuration file according to the current time and the on_time and off_time. This command is intended to be run hourly as a cron job. For example, you can add the following line to your crontab:

0 * * * * /path/to/peroutine cronjob

Tips

You can use ntfy or libnotify to send notifications in the on_command and off_command.

About

Fuck the fact that the number of days in a week is prime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages