Execute SSH Commands #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Execute SSH Commands | |
on: | |
workflow_dispatch: # အလုပ်အသွားအလာကို ကိုယ်တိုင်လုပ်ဆောင်ပါ။ | |
schedule: | |
- cron: "30 0,13 * * *" # ဘေဂျင်းစံတော်ချိန် နံနက် ၈း၃၀ မှ ည ၉း၃၀ နာရီအထိ နေ့စဉ် တစ်ကြိမ် လည်ပတ်သည်။ | |
jobs: | |
execute-commands: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up SSHPass | |
run: sudo apt-get update && sudo apt-get install -y sshpass | |
- name: Get ACCOUNTS_JSON | |
id: get-accounts | |
run: | | |
echo "$ACCOUNTS_JSON" > accounts.json | |
env: | |
ACCOUNTS_JSON: ${{ secrets.ACCOUNTS_JSON }} | |
# GitHub Secrets မှ ACCOUNTS_JSON ပြောင်းလဲမှုအား ရယူပြီး ဖိုင် accounts.json တွင် သိမ်းဆည်းပါ။ | |
- name: Generate SSH Commands | |
id: generate-ssh-commands | |
run: | | |
echo "#!/bin/bash" > sshpass.sh | |
while IFS= read -r account; do | |
username=$(echo "$account" | jq -r '.username') | |
password=$(echo "$account" | jq -r '.password') | |
ssh=$(echo "$account" | jq -r '.ssh') | |
echo "echo \"Executing for $username@$ssh\"" >> sshpass.sh | |
echo "sshpass -p '$password' ssh -o StrictHostKeyChecking=no '$username@$ssh' 'bash <(curl -s https://raw.githubusercontent.com/cmliu/socks5-for-serv00/main/check_cron.sh)'" >> sshpass.sh | |
done < <(jq -c '.[]' accounts.json) | |
chmod +x sshpass.sh | |
- name: Execute SSH Commands | |
run: ./sshpass.sh |