GithubHelp home page GithubHelp logo

bash_alarm_clock's Introduction

bash_alarm_clock

A fully featured bash alarm clock leveraging cron

Contents

  1. About
  2. License
  3. Prerequisites
  4. Configuration
  5. Usage
  6. TODO

1. About

This is a program greatly indebted to various cron alarm clocks like this one, though it has some features that those simple ones don't have.

The briefing.sh script is described on my blog how to get a daily briefing.

2. License

This project is licensed under the MIT license. For the full license, see LICENSE.

3. Prerequisites

These may already be installed on your system.

  • kill can be found on major Linux distributions.
  • pkill can be found on major Linux distributions.
  • date can be found on major Linux distributions.
  • sed can be found on major Linux distributions.
  • ls can be found on major Linux distributions.
  • cronic to reduce cron's email output, found here

Useful tools to use with this alarm clock.

  • mplayer command-line tool for playing media. mplayer can be found on major Linux distributions.
  • podfox command-line tool for podcasts, found here
  • gnome-schedule if you aren't comfy with crontab -e, found here

4. Configuration

Configuration file

Edit the RC file and put it in $HOME/.config/bash_alarm to put your alarms there in the format:

24 HOUR TIME;DAY OF WEEK[UMTWRFS];ALARM GROUP;[COMMAND]

e.g.

0530;MTWRF;music;/usr/bin/mplayer -noconsolecontrols -ao pulse -volume 100 -really-quiet -loop 5 "~/alarm.mp3" &

Would use mplayer to play an alarm at 5:30 AM every weekday, and

1400;US;music;/usr/bin/mplayer -noconsolecontrols -ao pulse -volume 100 -really-quiet -loop 5 "~/wave_sounds.mp3" &

would use mplayer to play a different wave-crashing sound at 2:00 PM on Sunday and Saturday.

The semicolon is the dividing mark; your command should NOT have a semicolon in it. Right now, that means calling something like briefing.sh a minute or two before the playing command.

Crontab change

Edit your crontab using either crontab -e or a tool like gnome-schedule to call the script once a minute with the -c command line variable, e.g.

* * * * * * /usr/bin/cronic /PATH/TO/bash_alarm.sh -c

Notes about setting up alarms

I added export XDG_RUNTIME_DIR="/run/user/1000" to the alarm script to solve a problem raised and solved here about running audio apps from cron.

If you have problems with mplayer not playing, try using -noconsolecontrols as an argument.

5. Usage

  • Running a check

Run bash_alarm.sh -c, either from cron or the commandline.

Both of these commands are intentionally slightly cumbersome, because this is being used as an alarm clock...

  • Stopping alarms

Run bash_alarm.sh -k [all|group name]. If you specify all, you do not need to specify any other group name. Otherwise, it will only kill alarms that are part of the named group.

  • Snoozing alarms

Run bash_alarm.sh -s [all|group name] [snooze time in minutes]. If you specify all, you do not need to specify any other group name. Otherwise, it will only snooze alarms that are part of the named group. The snooze time should only be a whole number. If no number is specified, the snooze time is set to 5.

6. Todo

  • Way to non-manually add single-time alarms
  • How to skip alarm for next day
  • GUI (or at least non-programatically editing) interface

bash_alarm_clock's People

Contributors

uriel1998 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.