diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-12-10 22:10:37 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-12-10 22:17:13 +0100 |
commit | 03938f718be722a92d26279a5edd822f9261228a (patch) | |
tree | a6aad8315672c29632f7be9ba49ef74d7e4dd239 /src/conf_mode | |
parent | 2daa8aa6892d990d12c50bf16095dac0e1f179c7 (diff) | |
download | vyos-1x-03938f718be722a92d26279a5edd822f9261228a.tar.gz vyos-1x-03938f718be722a92d26279a5edd822f9261228a.zip |
wwan: T3795: only enable cron helper when interface is in use
(cherry picked from commit e73b40a04ee90a91b778ce72a60cbb751f42a306)
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/interfaces-wwan.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-wwan.py b/src/conf_mode/interfaces-wwan.py index 7fdd0d447..e052e152d 100755 --- a/src/conf_mode/interfaces-wwan.py +++ b/src/conf_mode/interfaces-wwan.py @@ -30,12 +30,14 @@ from vyos.util import call from vyos.util import dict_search from vyos.util import DEVNULL from vyos.util import is_systemd_service_active +from vyos.util import write_file from vyos.template import render from vyos import ConfigError from vyos import airbag airbag.enable() service_name = 'ModemManager.service' +cron_script = '/etc/cron.d/wwan' def get_config(config=None): """ @@ -80,6 +82,11 @@ def verify(wwan): return None def generate(wwan): + if 'deleted' in wwan: + return None + + if not os.path.exists(cron_script): + write_file(cron_script, '*/5 * * * * root /usr/libexec/vyos/vyos-check-wwan.py') return None def apply(wwan): @@ -108,6 +115,10 @@ def apply(wwan): # There are no other WWAN interfaces - stop the daemon if 'other_interfaces' not in wwan: cmd(f'systemctl stop {service_name}') + # Clean CRON helper script which is used for to re-connect when + # RF signal is lost + if os.path.exists(cron_script): + os.unlink(cron_script) return None |