We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

Script to reset network connection every x minutes

asked 2019-08-20 18:29:38 +0300

RobNas gravatar image

There's the option to reset network connection in the tools in settings (where the homescreen can be restarted and backups can be removed). Is it possible to have a script which resets the network connection every 3 or 5 minutes or so (and a script to disable this)? I've got issues with the WIFI connection where I work and I keep losing connection with Whatsapp. Resetting it solves it and I don't believe it will be solved by addressing this issue, because I don't know if the root cause is on the router-side or in my phone. I already have this issue with the Jolla 1, my previous Sailfish phone.

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-20 19:43:06 +0300

onehundredpercentdruken gravatar image

updated 2019-08-20 19:50:02 +0300

Reference: Mobile network gets lost and is not restored

That would be one part. The bash script is another. You need to start it and stop it.

#!/bin/bash

while [ true ]
do
   echo la lala
   sleep 5
done

Stopping should be done via terminal, then. Or with the help of the preferences. Just some suggestions.

edit flag offensive delete publish link more

Comments

1

Better yet, a systemd timer which restarts the network/ofono service in a fixed interval.

André ( 2019-08-21 03:24:06 +0300 )edit

@AndréStackexchange

That would indeed be an option, requires some skill in setting it up properly, though,

onehundredpercentdruken ( 2019-08-21 08:00:38 +0300 )edit

What about Cron, would that work?

Levone1 ( 2019-08-21 12:58:14 +0300 )edit

This was a bit** to debug without proper logging and this antique version of systemd. We need to create two extra service files like this:

/etc/systemd/system/ofono-restart.timer

[Unit]
Description=restart ofono timer 60 min after boot and every 60 min from there on

[Timer]
OnBootSec=60min
OnUnitActiveSec=60m

[Install]
WantedBy=timers.target

/etc/systemd/system/ofono-restart.service

[Unit]
Description=restart ofono

[Service]
Type=oneshot
ExecStart=/bin/systemctl try-restart ofono.service

usage:

To start the service:

systemctl start ofono-restart.timer

To keep it persistent, timer unit needs to be enabled:

systemctl enable ofono-restart.timer
André ( 2019-08-23 17:21:58 +0300 )edit
Login/Signup to Answer

Question tools

Follow
3 followers

Stats

Asked: 2019-08-20 18:29:38 +0300

Seen: 175 times

Last updated: Aug 20 '19