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 |
@@ -0,0 +1,21 @@ |
25 |
+#!/bin/bash |
26 |
+ |
27 |
+path='PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin' |
28 |
+cronfile='/var/spool/cron/asterisk2' |
29 |
+status=$(/sbin/e-smith/config getprop freepbx status || echo "disabled") |
30 |
+ |
31 |
+# add PATH to fist line if not present; else update it |
32 |
+sed -i "1!b;s/^PATH.*/$path/; t; 1i $path" $cronfile |
33 |
+# remove any other occurence of PATH |
34 |
+sed -i "1p;t; /^PATH.*/d" $cronfile |
35 |
+ |
36 |
+# check if freepbx enabled |
37 |
+if [[ $status == "enabled" ]]; then |
38 |
+ # if enabled uncomment |
39 |
+ sed -ri 's/^#(\@[a-zA-Z]+ .*|[0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ .*)/\1/' $cronfile |
40 |
+else |
41 |
+ # if disabled comment out |
42 |
+ sed -ri 's/^(\@[a-zA-Z]+ .*|[0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ [0-9*]+ .*)/#\1/' $cronfile |
43 |
+fi |
44 |
+#remove any duplicate entry |
45 |
+awk '!x[$0]++' ${cronfile} >${cronfile}-tmp && cat ${cronfile}-tmp > ${cronfile} && rm -f ${cronfile}-tmp |