added a cron mode. this will execute the script only once and then execute

This commit is contained in:
Johannes Findeisen 2020-09-07 03:16:55 +02:00
commit 9776448c89
3 changed files with 5 additions and 1 deletions

View file

@ -35,6 +35,7 @@ Edit config.json to your needs.
{
"interval": 60,
"database": "./uplink.sqlite3",
"cron_mode": false,
"uplinks": [
{ "provider": "Cable Provider", "ip": "192.168.0.1", "password": "1234" },
{ "provider": "DSL Provider", "ip": "192.168.1.1", "password": "1234" }
@ -68,7 +69,7 @@ can move fast-forward.
- A lot... :)
- SQL server backend
- Gtk+ frontend
- A cron mode to not let uplink run in an endless loop to be scheduled and executed by cron.
- ~~A cron mode to not let uplink run in an endless loop to be scheduled and executed by cron.~~
- A daemon mode to be a real UNIX daemon. For now, it's just "sleep" based.
- Platform independence

View file

@ -1,6 +1,7 @@
{
"interval": 60,
"database": "./uplink.sqlite3",
"cron_mode": false,
"uplinks": [
{ "provider": "Cable Provider", "ip": "192.168.0.1", "password": "1234" },
{ "provider": "DSL Provider", "ip": "192.168.1.1", "password": "1234" }

2
uplink
View file

@ -128,6 +128,8 @@ def run(config):
# with daemon.DaemonContext():
while True:
get_data(config)
if config["cron_mode"]:
exit(0)
time.sleep(config["interval"])