Skip to content

Commit

Permalink
Merge pull request #28 from hazcod/fix/ventura
Browse files Browse the repository at this point in the history
feat: support @ crontab notation
  • Loading branch information
hazcod authored Nov 13, 2023
2 parents 04e0d4d + 933a509 commit 0a49626
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions maclaunch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ function getKernelExtensions {
}

function getCronjobs {
crontab -l 2>/dev/null | grep -v '^#' | cut -d ' ' -f 6
while IFS= read -r cron; do
if [ -z "$cron" ]; then
continue
fi

if echo "$cron" | cut -d ' ' -f 1 | grep -q '@'; then
# @reboot notation
echo "$cron" | cut -d ' ' -f 2
else
# * * * * * notation
echo "$cron" | cut -d ' ' -f 6
fi
done <<<"$(crontab -l 2>/dev/null | grep -v '^#' | grep -vE '^\n')"
}

function listCronJobs {
Expand All @@ -76,7 +88,7 @@ function listCronJobs {
echo -e " Type : cronjob"
echo -e " User : $(whoami)"
echo -e " Launch: ${ORANGE}enabled${NC}"
echo " File : n/a"
echo " File : ${name}"
done
}

Expand Down

0 comments on commit 0a49626

Please sign in to comment.