Closed heywoodlh closed 5 years ago
What's inside ~/scripts/check-shell.sh ?
Also, since termux-api v0.34 you don't need to explicitly state --network any
because it is the default.
It's a script to check if an SSH process is running and if it isn't it runs another script to re-establish the tunnel (this isn't my most elegant script):
$ cat scripts/check-shell.sh
#!/usr/bin/env bash
ps aux | grep ssh | grep skynet | grep -q boomerang
STATUS="$?"
DATE="$(date +%m-%d_%H:%M)"
echo "reverse shell last checked: $DATE" > ~/log/shell-check.txt
if [[ "$STATUS" != 0 ]]
then
echo "reverse shell not running, restarting."
pkill sshd; sshd -E ~/log/ssh.log
~/.termux/boot/reverse-ssh.sh
else
echo "reverse shell is running, exiting"
fi
As a hack-ey control, you can see that I have it echo the time that the script is run to ~/log/shell-check.txt
and it never updates unless I run the script manually.
I did have a thought, maybe Termux's job scheduler handles STDOUT differently so that the echo command isn't ever redirected to the file? I would guess not because the SSH connection never gets re-established, but just a guess.
Run termux-fix-shebang ~/scripts/check-shell.sh
and retry. It should work (just tested and it worked for me).
That seems to have fixed it. Thanks!
Trying to run a script with the job-scheduler and it doesn't seem to run every 15 minutes (despite it showing up in
termux-job-scheduler --pending
).Aside from installing the
termux-api
package, is there something I need to do to ensure the job is runs?Here is my command to schedule the job:
Here is the pending job:
Again, is there some other step I am missing to ensure that my job runs?