Skip to content

Commit

Permalink
fix: do not remove other cronjobs
Browse files Browse the repository at this point in the history
  • Loading branch information
strdr4605 committed Feb 24, 2022
1 parent 72fff37 commit f9be5c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ tt() {
-a | --abort)
echo "Abort activity"
echo "" >"$TT_SESSION"
crontab -r
crontab -l | grep -v "tt" | crontab -
;;
-l | --logs)
cat "$TT_LOGS"
Expand Down Expand Up @@ -91,7 +91,7 @@ tt() {
echo "activity_name=${activity_name}" >>"$TT_SESSION"
# runs on MacOS
if [ "$(uname)" = "Darwin" ]; then
(printf '*/15 * * * * say "Activity from tt is active!"\n') | crontab
(crontab -l | grep -v "tt" ; printf '*/15 * * * * say "Activity from tt is active!"\n') | crontab -
fi
fi
return
Expand All @@ -107,7 +107,7 @@ tt() {
echo "activity_name=$1" >>"$TT_SESSION"
# runs on MacOS
if [ "$(uname)" = "Darwin" ]; then
(printf '*/15 * * * * say "Activity from tt is active!"\n') | crontab
(crontab -l | grep -v "tt" ; printf '*/15 * * * * say "Activity from tt is active!"\n') | crontab -
fi
}

Expand All @@ -134,7 +134,7 @@ tt() {
echo "Activity '$activity_name' paused at ${hours}h ${mins}m"
# runs on MacOS
if [ "$(uname)" = "Darwin" ]; then
(printf '* * * * * say "Activity from tt is paused!"\n') | crontab
(crontab -l | grep -v "tt" ; printf '* * * * * say "Activity from tt is paused!"\n') | crontab -
fi
}

Expand All @@ -158,7 +158,7 @@ tt() {
sec_diff=$((finish_timestamp - start_time + elapsed_sec))
_save "$activity_name" $sec_diff
echo "" >"$TT_SESSION"
crontab -r
crontab -l | grep -v "tt" | crontab -
}

_save() {
Expand Down

0 comments on commit f9be5c8

Please sign in to comment.