Skip to content

Commit 0a49626

Browse files
authored
Merge pull request #28 from hazcod/fix/ventura
feat: support @ crontab notation
2 parents 04e0d4d + 933a509 commit 0a49626

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

maclaunch.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,19 @@ function getKernelExtensions {
6060
}
6161

6262
function getCronjobs {
63-
crontab -l 2>/dev/null | grep -v '^#' | cut -d ' ' -f 6
63+
while IFS= read -r cron; do
64+
if [ -z "$cron" ]; then
65+
continue
66+
fi
67+
68+
if echo "$cron" | cut -d ' ' -f 1 | grep -q '@'; then
69+
# @reboot notation
70+
echo "$cron" | cut -d ' ' -f 2
71+
else
72+
# * * * * * notation
73+
echo "$cron" | cut -d ' ' -f 6
74+
fi
75+
done <<<"$(crontab -l 2>/dev/null | grep -v '^#' | grep -vE '^\n')"
6476
}
6577

6678
function listCronJobs {
@@ -76,7 +88,7 @@ function listCronJobs {
7688
echo -e " Type : cronjob"
7789
echo -e " User : $(whoami)"
7890
echo -e " Launch: ${ORANGE}enabled${NC}"
79-
echo " File : n/a"
91+
echo " File : ${name}"
8092
done
8193
}
8294

0 commit comments

Comments
 (0)