Last active
July 29, 2022 15:42
-
-
Save tenequm/0f7d8afb3ce26939aad497b9186a9cff to your computer and use it in GitHub Desktop.
Near ping automation
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
#!/bin/bash | |
# Set variables | |
read -p "Your wallet account ID (e.g. for 'demo.shardnet.near' wallet enter 'demo'): " ACCOUNTID | |
read -p "Your staking pool ID (e.g. for 'demo.factory.shardnet.near' enter'demo'): " POOLID | |
# Creating script file | |
cat << EOF > $HOME/near-ping.sh | |
#!/bin/bash | |
# Ping call to renew Proposal added to crontab | |
export POOLID=${POOLID} | |
export ACCOUNTID=${ACCOUNTID} | |
export NEAR_ENV=shardnet | |
export LOGS=${HOME}/logs | |
if [[ ! -d \${LOGS} ]]; then mkdir -p \${LOGS}; fi | |
echo "---" >> \${LOGS}/all.log | |
date >> \${LOGS}/all.log | |
near call \${POOLID}.factory.shardnet.near ping '{}' --accountId \${ACCOUNTID}.shardnet.near --gas=300000000000000 >> \${LOGS}/all.log | |
near proposals | grep \${POOLID} >> \${LOGS}/all.log | |
near validators current | grep \${POOLID} >> \${LOGS}/all.log | |
near validators next | grep \${POOLID} >> \${LOGS}/all.log | |
EOF | |
chmod +x ${HOME}/near-ping.sh | |
(crontab -l; echo "0 */2 * * * ${HOME}/near-ping.sh")|awk '!x[$0]++'|crontab - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment