change default service interval to 5 minutes, clarify interval updates apply without restart
This commit is contained in:
1 parent
f6cbaa1a6f
commit
bdfe0c1412
2 files changed
+8
-2
No files matched your search
@@ -164,7 +164,7 @@ Instead of running the script by hand every time you add something, `--service`
|
|||||||
|
|
||||||
```
|
```
|
||||||
python plex-library-tool.py --service # pick share(s) interactively, then start
|
python plex-library-tool.py --service # pick share(s) interactively, then start
|
||||||
python plex-library-tool.py --service "/Volumes/Movies" # add a share and start (default: every 60s)
|
python plex-library-tool.py --service "/Volumes/Movies" # add a share and start (default: every 5 minutes)
|
||||||
python plex-library-tool.py --service 120 # set the interval to 120 seconds and start
|
python plex-library-tool.py --service 120 # set the interval to 120 seconds and start
|
||||||
python plex-library-tool.py --service start # start using the current configuration
|
python plex-library-tool.py --service start # start using the current configuration
|
||||||
python plex-library-tool.py --service stop # stop the service
|
python plex-library-tool.py --service stop # stop the service
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ NAMES_FILE = SCRIPT_DIR / "names.yaml"
|
|||||||
CLEANUP_TRASH_DIR = SCRIPT_DIR / ".trash"
|
CLEANUP_TRASH_DIR = SCRIPT_DIR / ".trash"
|
||||||
SERVICE_CONFIG_FILE = SCRIPT_DIR / "service.json"
|
SERVICE_CONFIG_FILE = SCRIPT_DIR / "service.json"
|
||||||
SERVICE_LOG_FILE = LOG_DIR / "service.log"
|
SERVICE_LOG_FILE = LOG_DIR / "service.log"
|
||||||
DEFAULT_SERVICE_INTERVAL = 60
|
DEFAULT_SERVICE_INTERVAL = 300
|
||||||
|
|
||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
|
|
||||||
@@ -4040,6 +4040,12 @@ def handle_service_command(value):
|
|||||||
config = load_service_config()
|
config = load_service_config()
|
||||||
config["interval"] = interval
|
config["interval"] = interval
|
||||||
save_service_config(config)
|
save_service_config(config)
|
||||||
|
|
||||||
|
existing_pid = config.get("pid")
|
||||||
|
if existing_pid and is_process_running(existing_pid):
|
||||||
|
print(f"Interval updated to {interval}s. The running service (PID {existing_pid}) will pick it up on its next cycle.")
|
||||||
|
return
|
||||||
|
|
||||||
if not config.get("paths"):
|
if not config.get("paths"):
|
||||||
print(f"Interval set to {interval}s. No shares configured yet.")
|
print(f"Interval set to {interval}s. No shares configured yet.")
|
||||||
interactive_configure_service()
|
interactive_configure_service()
|
||||||
|
|||||||
Reference in new issue
Block a user