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 subprocess
|
||||
import shutil
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
@ -82,33 +82,12 @@ if __name__ == "__main__":
|
||||
with open(ntf.name, "w") as tf:
|
||||
tf.writelines(format_infohashes)
|
||||
|
||||
# Use scp to copy the infohashes file to the torrent tracker's config
|
||||
# directory on the remote torrent tracker server, overwriting the
|
||||
# whitelist.txt file
|
||||
# Use shutil.copy to copy the infohashes file to the torrent tracker's config
|
||||
# directory, overwriting the whitelist.txt file.
|
||||
console.log(
|
||||
"SSH-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",
|
||||
]
|
||||
"Copying the temporary infohashes file to the torrent tracker's whitelist."
|
||||
)
|
||||
shutil.copy(ntf.name, "/etc/opentracker/whitelist.txt")
|
||||
|
||||
# Reannounce all torrents in each qBittorrent instance to their trackers
|
||||
console.log("Reannouncing all torrents to their trackers.")
|
||||
|
Loading…
Reference in New Issue
Block a user