diff --git a/d1/cpanel.py b/d1/cpanel.py index d285874..047a51b 100644 --- a/d1/cpanel.py +++ b/d1/cpanel.py @@ -97,27 +97,34 @@ while True: except: logging.error(json.dumps(dict( error=traceback.format_exc(), + time_iso=datetime.datetime.now().isoformat(), ))) not_alive = True if not_alive: logging.error(json.dumps( dict( - o=pprint.pformat(o.__dict__), + args=o.args, + k=k, + #o=pprint.pformat(o.__dict__), status='not_alive', + time_iso=datetime.datetime.now().isoformat(), ) )) - stop_task(o) - del t1[k] + #stop_task(o) + #del t1[k] continue if not o.poll() is None: logging.error(json.dumps( dict( - o=pprint.pformat(o.__dict__), + #o=pprint.pformat(o.__dict__), + args=o.args, + k=k, return_code=o.poll(), status='crashed', + time_iso=datetime.datetime.now().isoformat(), ) )) del t1[k] diff --git a/d1/cpanel_app.sh b/d1/cpanel_app.sh new file mode 100644 index 0000000..81c043c --- /dev/null +++ b/d1/cpanel_app.sh @@ -0,0 +1,35 @@ +( + echo -e "#!/bin/sh\necho \$CPANEL_SSH_PASS" > /tmp/askpass.sh && + chmod +x /tmp/askpass.sh && + DISPLAY=blah \ + SSH_ASKPASS=/tmp/askpass.sh \ + SSH_ASKPASS_REQUIRE=prefer \ + ssh-add $T1 +) && +ssh-add -l && +while true; do + for k in $(seq 9051 15000); + do + date; echo $k; + ssh \ + -C -o 'ServerAliveInterval=2' -o 'ConnectTimeout=2' \ + -o 'ExitOnForwardFailure=yes' \ + -i $T1 \ + $T3@$T2 \ + 'exec tmp/busybox pkill -f proxy.json'; + ssh \ + -C -o 'ServerAliveInterval=2' -o 'ConnectTimeout=2' \ + -o 'ExitOnForwardFailure=yes' \ + -i $T1 \ + $T3@$T2 \ + 'exec tmp/busybox pkill -f 99999942'; + ssh \ + -C -o 'ServerAliveInterval=2' -o 'ConnectTimeout=2' \ + -o 'ExitOnForwardFailure=yes' \ + -i $T1 \ + $T3@$T2 \ + -R 127.0.0.1:$k:app:80 \ + '(echo [\"127.0.0.1:'$k'\"] > /home/'$T3'/proxy.json && exec sleep 99999942)'; + sleep 1; + done; +done;