Skip to content

Commit c232ad4

Browse files
committed
fix: 25-add-cron-jobs.sh - fixes #692
1 parent caeaa99 commit c232ad4

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

on-boot-script-2.x/examples/udm-files/on_boot.d/25-add-cron-jobs.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Get DataDir location
2+
# Get ${DATA_DIR} location
33
DATA_DIR="/data"
44
case "$(ubnt-device-info firmware || true)" in
55
1*)
@@ -13,10 +13,18 @@ case "$(ubnt-device-info firmware || true)" in
1313
exit 1
1414
;;
1515
esac
16+
1617
## Store crontab files in ${DATA_DIR}/cronjobs/ (you will need to create this folder).
1718
## This script will re-add them on startup.
1819

1920
cp ${DATA_DIR}/cronjobs/* /etc/cron.d/
20-
/etc/init.d/crond restart
21+
# Older UDM's had crond, so lets check if its here if so use that one, otherwise use cron
22+
if [ -x /etc/init.d/crond ]; then
23+
/etc/init.d/crond restart
24+
elif [ -x /etc/init.d/cron ]; then
25+
/etc/init.d/cron restart
26+
else
27+
echo "Neither crond nor cron found."
28+
fi
2129

2230
exit 0
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
11
#!/bin/bash
2-
# Get DataDir location
2+
# Get ${DATA_DIR} location
33
DATA_DIR="/data"
44
case "$(ubnt-device-info firmware || true)" in
55
1*)
66
DATA_DIR="/mnt/data"
77
;;
8-
2*)
8+
2* | 3* | 4* | 5*)
99
DATA_DIR="/data"
1010
;;
11-
3*)
12-
DATA_DIR="/data"
13-
;;
14-
4*)
15-
DATA_DIR="/data"
16-
;;
1711
*)
1812
echo "ERROR: No persistent storage found." 1>&2
1913
exit 1
2014
;;
2115
esac
16+
2217
## Store crontab files in ${DATA_DIR}/cronjobs/ (you will need to create this folder).
2318
## This script will re-add them on startup.
2419

2520
cp ${DATA_DIR}/cronjobs/* /etc/cron.d/
2621
# Older UDM's had crond, so lets check if its here if so use that one, otherwise use cron
2722
if [ -x /etc/init.d/crond ]; then
28-
/etc/init.d/crond restart
23+
/etc/init.d/crond restart
2924
elif [ -x /etc/init.d/cron ]; then
30-
/etc/init.d/cron restart
25+
/etc/init.d/cron restart
3126
else
32-
echo "Neither crond nor cron found."
27+
echo "Neither crond nor cron found."
3328
fi
3429

3530
exit 0

0 commit comments

Comments
 (0)