Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
auto-restart scripts for IdexD

Get Started

Create to load nvm


# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
export NVM_DIR="/home/<username>/.nvm"
[ -s "$NVM_DIR/" ] && . "$NVM_DIR/"  # This loads nvm



IDEX=$(which idex)
IDEX_STATUS=$(${IDEX} status)
IS_OFFLINE=$(echo "${IDEX_STATUS}" | grep offline | wc -l)
LOG_MESSAGE=$(echo $(date):Idexd)

if [ ${IS_OFFLINE} -eq 1 ]; then
	${IDEX} stop
	${IDEX} start --rpc<YOUR API KEY>
	LOG_MESSAGE=$(echo ${LOG_MESSAGE} restarted)
	LOG_MESSAGE=$(echo ${LOG_MESSAGE} is online)
echo "${IDEX_STATUS}" | grep "My Period Credits"

Add job to crontab

$ crontab -e
*/10 * * * * (. /home/<username>/; . /home/<username>/ >> /home/<username>/idexd.log; )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment