mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-25 09:03:41 +01:00
Remove SSH code
This commit is contained in:
parent
90db8fbda4
commit
1fdb07e6c0
@ -30,7 +30,7 @@ Examples:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -82,33 +82,12 @@ if __name__ == "__main__":
|
|||||||
with open(ntf.name, "w") as tf:
|
with open(ntf.name, "w") as tf:
|
||||||
tf.writelines(format_infohashes)
|
tf.writelines(format_infohashes)
|
||||||
|
|
||||||
# Use scp to copy the infohashes file to the torrent tracker's config
|
# Use shutil.copy to copy the infohashes file to the torrent tracker's config
|
||||||
# directory on the remote torrent tracker server, overwriting the
|
# directory, overwriting the whitelist.txt file.
|
||||||
# whitelist.txt file
|
|
||||||
console.log(
|
console.log(
|
||||||
"SSH-copying the temporary infohashes file to the torrent tracker's whitelist."
|
"Copying the temporary infohashes file to the torrent tracker's whitelist."
|
||||||
)
|
|
||||||
subprocess.run(
|
|
||||||
[
|
|
||||||
"scp",
|
|
||||||
"-q",
|
|
||||||
ntf.name,
|
|
||||||
f"root@{tracker_domain}:/etc/opentracker/whitelist.txt",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Use SSH to run `systemctl restart opentracker.service` on the remote
|
|
||||||
# torrent tracker server
|
|
||||||
console.log("Restarting opentracker.service on the remote server.")
|
|
||||||
subprocess.run(
|
|
||||||
[
|
|
||||||
"ssh",
|
|
||||||
f"root@{tracker_domain}",
|
|
||||||
"systemctl",
|
|
||||||
"restart",
|
|
||||||
"opentracker.service",
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
shutil.copy(ntf.name, "/etc/opentracker/whitelist.txt")
|
||||||
|
|
||||||
# Reannounce all torrents in each qBittorrent instance to their trackers
|
# Reannounce all torrents in each qBittorrent instance to their trackers
|
||||||
console.log("Reannouncing all torrents to their trackers.")
|
console.log("Reannouncing all torrents to their trackers.")
|
||||||
|
Loading…
Reference in New Issue
Block a user