use subprocess instead
This commit is contained in:
parent
22328683ea
commit
c2acfa6431
2 changed files with 5 additions and 5 deletions
4
PKGBUILD
4
PKGBUILD
|
@ -20,11 +20,11 @@ package() {
|
||||||
cd $pkgname
|
cd $pkgname
|
||||||
|
|
||||||
# prepare dirs
|
# prepare dirs
|
||||||
install -dm755 "$pkgdir/usr/bin"
|
install -dm755 "$pkgdir/usr/lib/safe-harbor"
|
||||||
install -dm755 "$pkgdir/usr/lib/systemd/system"
|
install -dm755 "$pkgdir/usr/lib/systemd/system"
|
||||||
install -dm755 "$pkgdir/etc/safe-harbor"
|
install -dm755 "$pkgdir/etc/safe-harbor"
|
||||||
|
|
||||||
cp bin/safe-harbor.py "$pkgdir/usr/bin"
|
cp bin/safe-harbor.py "$pkgdir/usr/lib/safe-harbor"
|
||||||
cp systemd/safe-harbor@.service "$pkgdir/usr/lib/systemd/system"
|
cp systemd/safe-harbor@.service "$pkgdir/usr/lib/systemd/system"
|
||||||
cp config.json.example "$pkgdir/etc/safe-harbor"
|
cp config.json.example "$pkgdir/etc/safe-harbor"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import jsmin
|
import jsmin
|
||||||
import json
|
import json
|
||||||
import os
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -15,7 +15,7 @@ if __name__ == "__main__":
|
||||||
with open(cfg_path) as f:
|
with open(cfg_path) as f:
|
||||||
cfg = json.loads(jsmin.jsmin(f.read()))
|
cfg = json.loads(jsmin.jsmin(f.read()))
|
||||||
|
|
||||||
command = ["/usr/bin/ssh", "ssh", "-o", "ServerAliveInterval 45", "-o", "ServerAliveCountMax 2", "-o", "ExitOnForwardFailure yes", "-N"]
|
command = ["/usr/bin/ssh", "-o", "ServerAliveInterval 45", "-o", "ServerAliveCountMax 2", "-o", "ExitOnForwardFailure yes", "-N"]
|
||||||
|
|
||||||
for m in cfg["mapping"]:
|
for m in cfg["mapping"]:
|
||||||
command.append("-R")
|
command.append("-R")
|
||||||
|
@ -24,4 +24,4 @@ if __name__ == "__main__":
|
||||||
command.append("%s@%s" %(cfg["user"], cfg["host"]))
|
command.append("%s@%s" %(cfg["user"], cfg["host"]))
|
||||||
|
|
||||||
# replace this process, systemd will restart us if needed
|
# replace this process, systemd will restart us if needed
|
||||||
os.execl(*command)
|
subprocess.run(command)
|
Loading…
Add table
Add a link
Reference in a new issue