aboutsummaryrefslogtreecommitdiff
path: root/xalarm
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-27 08:02:39 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-27 08:02:39 -0300
commite0b9d93101a679a9eed199d0b266622285013216 (patch)
tree4a3b348f95f4f3724839c897dd8b8e4c9602f4ef /xalarm
parent66519702fc77702216aad6a86076918660373cd9 (diff)
downloadutils-x11-e0b9d93101a679a9eed199d0b266622285013216.tar.gz
utils-x11-e0b9d93101a679a9eed199d0b266622285013216.tar.bz2
Adds pause and resume actions
Diffstat (limited to 'xalarm')
-rwxr-xr-xxalarm30
1 files changed, 30 insertions, 0 deletions
diff --git a/xalarm b/xalarm
index df613e5..a694e5a 100755
--- a/xalarm
+++ b/xalarm
@@ -51,6 +51,32 @@ function xalarm_cancel {
fi
}
+# Pause alarms
+function xalarm_pause {
+ if [ ! -z "$1" ]; then
+ if xalarm_list | awk '{ print $1 }' | grep -q "^$1"; then
+ kill -CONT $1
+ fi
+ else
+ for pid in `xalarm_list | awk '{ print $1 }'`; do
+ kill -CONT $pid
+ done
+ fi
+}
+
+# Resume alarms
+function xalarm_resume {
+ if [ ! -z "$1" ]; then
+ if xalarm_list | awk '{ print $1 }' | grep -q "^$1"; then
+ kill -CONT $1
+ fi
+ else
+ for pid in `xalarm_list | awk '{ print $1 }'`; do
+ kill -CONT $pid
+ done
+ fi
+}
+
# Usage
function xalarm_usage {
echo "usage: $BASENAME [list|cancel|kill|help|usage|loop] [timedef] [message]"
@@ -62,6 +88,10 @@ if [ "$1" == "list" ]; then
xalarm_list
elif [ "$1" == "cancel" ] || [ "$1" == "kill" ]; then
xalarm_cancel $2
+elif [ "$1" == "pause" ]; then
+ xalarm_pause $2
+elif [ "$1" == "resume" ]; then
+ xalarm_resume $2
elif [ "$1" == "help" ] || [ "$1" == "usage" ]; then
xalarm_usage
elif [ "$1" == "loop" ]; then