#!/bin/bash

source h-manifest.conf
source $CUSTOM_CONFIG_FILENAME
APPNMAE=$CUSTOM_NAME
APP_PATH=./$APPNMAE

pkill -9 $APPNMAE

GPU_STR=""
if command -v nvidia-smi >/dev/null 2>&1; then
    gpu_info=$(nvidia-smi -L)
    gpu_count=0
    while read -r line; do
        if [ $gpu_count -eq 0 ]; then
            GPU_STR="${gpu_count}"
        else
            GPU_STR="${GPU_STR},${gpu_count}"
        fi
        ((gpu_count++))

    done <<<"$gpu_info"
fi

  ./aleominer -d $GPU_STR -u $CUSTOM_URL -w $ACCOUNT  $EXTRA 2>&1 | tee --append ${CUSTOM_LOG_BASENAME}.log
