[~] Refactor
This commit is contained in:
parent
fdd19fbed2
commit
c943f75496
15
d1/cpanel.py
15
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]
|
||||
|
35
d1/cpanel_app.sh
Normal file
35
d1/cpanel_app.sh
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user