added a cron mode. this will execute the script only once and then execute
This commit is contained in:
parent
f02eb4068e
commit
9776448c89
3 changed files with 5 additions and 1 deletions
|
|
@ -35,6 +35,7 @@ Edit config.json to your needs.
|
||||||
{
|
{
|
||||||
"interval": 60,
|
"interval": 60,
|
||||||
"database": "./uplink.sqlite3",
|
"database": "./uplink.sqlite3",
|
||||||
|
"cron_mode": false,
|
||||||
"uplinks": [
|
"uplinks": [
|
||||||
{ "provider": "Cable Provider", "ip": "192.168.0.1", "password": "1234" },
|
{ "provider": "Cable Provider", "ip": "192.168.0.1", "password": "1234" },
|
||||||
{ "provider": "DSL Provider", "ip": "192.168.1.1", "password": "1234" }
|
{ "provider": "DSL Provider", "ip": "192.168.1.1", "password": "1234" }
|
||||||
|
|
@ -68,7 +69,7 @@ can move fast-forward.
|
||||||
- A lot... :)
|
- A lot... :)
|
||||||
- SQL server backend
|
- SQL server backend
|
||||||
- Gtk+ frontend
|
- 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.
|
- A daemon mode to be a real UNIX daemon. For now, it's just "sleep" based.
|
||||||
- Platform independence
|
- Platform independence
|
||||||
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"interval": 60,
|
"interval": 60,
|
||||||
"database": "./uplink.sqlite3",
|
"database": "./uplink.sqlite3",
|
||||||
|
"cron_mode": false,
|
||||||
"uplinks": [
|
"uplinks": [
|
||||||
{ "provider": "Cable Provider", "ip": "192.168.0.1", "password": "1234" },
|
{ "provider": "Cable Provider", "ip": "192.168.0.1", "password": "1234" },
|
||||||
{ "provider": "DSL Provider", "ip": "192.168.1.1", "password": "1234" }
|
{ "provider": "DSL Provider", "ip": "192.168.1.1", "password": "1234" }
|
||||||
|
|
|
||||||
2
uplink
2
uplink
|
|
@ -128,6 +128,8 @@ def run(config):
|
||||||
# with daemon.DaemonContext():
|
# with daemon.DaemonContext():
|
||||||
while True:
|
while True:
|
||||||
get_data(config)
|
get_data(config)
|
||||||
|
if config["cron_mode"]:
|
||||||
|
exit(0)
|
||||||
time.sleep(config["interval"])
|
time.sleep(config["interval"])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue