diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-06-21 09:07:11 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-06-21 09:07:11 +0200 |
| commit | e76b410b860cefe5f0a3f6c744f317899186e96b (patch) | |
| tree | fd310dda1cfe6bc341058cf8e03f442e661aa373 /scripts/sdep-checknow | |
| parent | b68c98a74cec75946eb29ae814da9fe6ae732cf8 (diff) | |
| download | sdep-e76b410b860cefe5f0a3f6c744f317899186e96b.tar.gz sdep-e76b410b860cefe5f0a3f6c744f317899186e96b.zip | |
Changed folder for scripts (see README.md diff)
Diffstat (limited to 'scripts/sdep-checknow')
| -rwxr-xr-x | scripts/sdep-checknow | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/sdep-checknow b/scripts/sdep-checknow index 4771957..2cb8f68 100755 --- a/scripts/sdep-checknow +++ b/scripts/sdep-checknow | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # Run this every minute (for example using cron) to receive a notification | 3 | # Run this every minute (for example using cron) to receive a notification |
| 4 | # when an event happens. | 4 | # when an event happens. |
| 5 | # | 5 | # |
| 6 | # The events are read from the following files in $sdepdata folder: | 6 | # The events are read from the following files in SDEPDATA folder: |
| 7 | # once: events that only happen once; full date needs to be specified | 7 | # once: events that only happen once; full date needs to be specified |
| 8 | # daily: events that happen every day; only specify the time in HH:MM format | 8 | # daily: events that happen every day; only specify the time in HH:MM format |
| 9 | # weekly: only specify Weekday + time | 9 | # weekly: only specify Weekday + time |
| @@ -14,8 +14,6 @@ | |||
| 14 | # might have to change if you are not on Linux (on some systems you can | 14 | # might have to change if you are not on Linux (on some systems you can |
| 15 | # accomplish the same with -j). | 15 | # accomplish the same with -j). |
| 16 | 16 | ||
| 17 | sdepdata="${XDG_DATA_HOME:-$HOME/.local/share}/sdep" | ||
| 18 | |||
| 19 | #notify="notify-send -t 3600000" | 17 | #notify="notify-send -t 3600000" |
| 20 | notify=herbe | 18 | notify=herbe |
| 21 | title="$(date +%H:%M)" | 19 | title="$(date +%H:%M)" |
| @@ -25,17 +23,17 @@ sdepnotify() { | |||
| 25 | } | 23 | } |
| 26 | 24 | ||
| 27 | # One-off events | 25 | # One-off events |
| 28 | sdepnotify <"$sdepdata/once" | 26 | sdepnotify <"SDEPDATA/once" |
| 29 | 27 | ||
| 30 | # Daily events | 28 | # Daily events |
| 31 | sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | sdepnotify | 29 | sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | sdepnotify |
| 32 | 30 | ||
| 33 | # Weekly events - needs GNU date (try -j intead of -d on BSD) | 31 | # Weekly events - needs GNU date (try -j intead of -d on BSD) |
| 34 | while read line; do | 32 | while read line; do |
| 35 | weekday=$(echo "$line" | sed "s/ .*$//") | 33 | weekday=$(echo "$line" | sed "s/ .*$//") |
| 36 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" | 34 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" |
| 37 | done <"$sdepdata/weekly" | \ | 35 | done <"SDEPDATA/weekly" | \ |
| 38 | sdepnotify | 36 | sdepnotify |
| 39 | 37 | ||
| 40 | # Monthly events | 38 | # Monthly events |
| 41 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" | sdepnotify | 39 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" | sdepnotify |
