1 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-freepbx-14.old/createlinks smeserver-freepbx-14/createlinks |
2 |
|
|
--- smeserver-freepbx-14.old/createlinks 2022-03-27 23:45:44.000000000 -0400 |
3 |
|
|
+++ smeserver-freepbx-14/createlinks 2022-04-16 21:38:51.027000000 -0400 |
4 |
|
|
@@ -31,6 +31,8 @@ |
5 |
|
|
event_link("freepbx-checkinstall-backup", $event, "11"); |
6 |
|
|
event_link("freepbx-amportal.conf", $event, "91"); |
7 |
|
|
event_link("freepbx-clean-crontab", $event, "40"); |
8 |
|
|
+event_link("freepbx-cron", $event, "40"); |
9 |
|
|
+ |
10 |
|
|
event_link("freepbx-dump-astdb", "pre-backup", "30"); |
11 |
|
|
event_link("freepbx-backup", "pre-backup", "31"); |
12 |
|
|
|
13 |
|
|
@@ -71,6 +73,7 @@ |
14 |
|
|
event_link("freepbx-checkinstall-backup", $event, "11"); |
15 |
|
|
event_link("freepbx-amportal.conf", $event, "91"); |
16 |
|
|
event_link("freepbx-clean-crontab", $event, "40"); |
17 |
|
|
+event_link("freepbx-cron", $event, "40"); |
18 |
|
|
|
19 |
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init"); |
20 |
|
|
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); |
21 |
|
|
diff -Nur --no-dereference smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-cron smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-cron |
22 |
|
|
--- smeserver-freepbx-14.old/root/etc/e-smith/events/actions/freepbx-cron 1969-12-31 19:00:00.000000000 -0500 |
23 |
|
|
+++ smeserver-freepbx-14/root/etc/e-smith/events/actions/freepbx-cron 2022-04-16 21:36:24.262000000 -0400 |
24 |
jpp |
1.2 |
@@ -0,0 +1,22 @@ |
25 |
jpp |
1.1 |
+#!/bin/bash |
26 |
|
|
+ |
27 |
|
|
+path='PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin' |
28 |
jpp |
1.2 |
+cronfile='/var/spool/cron/asterisk' |
29 |
|
|
+[ ! -f $cronfile ] && exit 0 |
30 |
jpp |
1.1 |
+status=$(/sbin/e-smith/config getprop freepbx status || echo "disabled") |
31 |
|
|
+ |
32 |
|
|
+# add PATH to fist line if not present; else update it |
33 |
|
|
+sed -i "1!b;s/^PATH.*/$path/; t; 1i $path" $cronfile |
34 |
|
|
+# remove any other occurence of PATH |
35 |
|
|
+sed -i "1p;t; /^PATH.*/d" $cronfile |
36 |
|
|
+ |
37 |
|
|
+# check if freepbx enabled |
38 |
|
|
+if [[ $status == "enabled" ]]; then |
39 |
|
|
+ # if enabled uncomment |
40 |
|
|
+ sed -ri 's/^#(\@[a-zA-Z]+ .*|[0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ .*)/\1/' $cronfile |
41 |
|
|
+else |
42 |
|
|
+ # if disabled comment out |
43 |
|
|
+ sed -ri 's/^(\@[a-zA-Z]+ .*|[0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ .*)/#\1/' $cronfile |
44 |
|
|
+fi |
45 |
|
|
+#remove any duplicate entry |
46 |
|
|
+awk '!x[$0]++' ${cronfile} >${cronfile}-tmp && cat ${cronfile}-tmp > ${cronfile} && rm -f ${cronfile}-tmp |