aboutsummaryrefslogtreecommitdiff
path: root/scripts/sdep-checknow
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2022-06-21 09:07:11 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2022-06-21 09:07:11 +0200
commite76b410b860cefe5f0a3f6c744f317899186e96b (patch)
treefd310dda1cfe6bc341058cf8e03f442e661aa373 /scripts/sdep-checknow
parentb68c98a74cec75946eb29ae814da9fe6ae732cf8 (diff)
downloadsdep-e76b410b860cefe5f0a3f6c744f317899186e96b.tar.gz
sdep-e76b410b860cefe5f0a3f6c744f317899186e96b.zip
Changed folder for scripts (see README.md diff)
Diffstat (limited to '')
-rwxr-xr-xscripts/sdep-checknow12
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
17sdepdata="${XDG_DATA_HOME:-$HOME/.local/share}/sdep"
18
19#notify="notify-send -t 3600000" 17#notify="notify-send -t 3600000"
20notify=herbe 18notify=herbe
21title="$(date +%H:%M)" 19title="$(date +%H:%M)"
@@ -25,17 +23,17 @@ sdepnotify() {
25} 23}
26 24
27# One-off events 25# One-off events
28sdepnotify <"$sdepdata/once" 26sdepnotify <"SDEPDATA/once"
29 27
30# Daily events 28# Daily events
31sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | sdepnotify 29sed "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)
34while read line; do 32while 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) /"
37done <"$sdepdata/weekly" | \ 35done <"SDEPDATA/weekly" | \
38sdepnotify 36sdepnotify
39 37
40# Monthly events 38# Monthly events
41sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" | sdepnotify 39sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" | sdepnotify

Generated with cgit - Back to sebastiano.tronto.net