diff --git a/.gitignore b/.gitignore index 17ca143..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -Quil_Balance_Checker/ \ No newline at end of file diff --git a/Quil_Balance_Checker/quil_balance_checker.sh b/Quil_Balance_Checker/quil_balance_checker.sh deleted file mode 100644 index bd8b0cb..0000000 --- a/Quil_Balance_Checker/quil_balance_checker.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Navigate to the directory -cd /root/ceremonyclient/client || exit - -# Run the command and extract the token balance -balance=$(./qclient token balance | grep -oP '\b\d+(?=\.\d+\s+QUIL)') - -# Check if balance is not empty -if [ -n "$balance" ]; then - # Get the current date in the required format - current_date=$(date +"%d/%m/%Y") - - # Log the balance value in CSV format - echo "$current_date,$balance" >> /root/scripts/log/quil_balance.csv -else - # Get the current date in the required format - current_date=$(date +"%d/%m/%Y") - - # Log "error" in CSV format - echo "$current_date,error" >> /root/scripts/log/quil_balance.csv -fi diff --git a/Quil_Balance_Checker/quil_balance_checker_installer.sh b/Quil_Balance_Checker/quil_balance_checker_installer.sh deleted file mode 100644 index 4a3070a..0000000 --- a/Quil_Balance_Checker/quil_balance_checker_installer.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -# Step 1: Ensure /root/scripts and /root/scripts/log directories exist -echo "Checking if /root/scripts and /root/scripts/log directories exist..." -if mkdir -p /root/scripts/log; then - echo "Directories ensured successfully." -else - echo "Failed to ensure directories." >&2 - exit 1 -fi - -# Step 2: Create or overwrite quil_balance_checker.sh -echo "Creating or overwriting /root/scripts/quil_balance_checker.sh..." -if echo '#!/bin/bash' > /root/scripts/quil_balance_checker.sh; then - echo "File /root/scripts/quil_balance_checker.sh created successfully." -else - echo "Failed to create /root/scripts/quil_balance_checker.sh." >&2 - exit 1 -fi - -# Step 3: Paste the script content into quil_balance_checker.sh -echo "Adding script content to /root/scripts/quil_balance_checker.sh..." -if echo "#!/bin/bash - -# Navigate to the directory -cd /root/ceremonyclient/client || exit - -# Run the command and extract the token balance -balance=\$(./qclient token balance | grep -oP '\\b\\d+(?=\\.\\d+\\s+QUIL)') - -# Check if balance is not empty -if [ -n \"\$balance\" ]; then - # Get the current date in the required format - current_date=\$(date +\"%d/%m/%Y\") - - # Log the balance value in CSV format - echo \"\$current_date,\$balance\" >> /root/scripts/log/quil_balance.csv -else - # Get the current date in the required format - current_date=\$(date +\"%d/%m/%Y\") - - # Log \"error\" in CSV format - echo \"\$current_date,error\" >> /root/scripts/log/quil_balance.csv -fi -" > /root/scripts/quil_balance_checker.sh; then - echo "Script content added successfully." -else - echo "Failed to add script content." >&2 - exit 1 -fi - -# Step 4: Grant execute permissions -echo "Setting execute permissions for /root/scripts/quil_balance_checker.sh..." -if chmod +x /root/scripts/quil_balance_checker.sh; then - echo "Execute permissions set successfully." -else - echo "Failed to set execute permissions." >&2 - exit 1 -fi - -# Step 5: Create cronjob if not already existing -echo "Checking for existing cronjob..." -if crontab -l | grep -q 'quil_balance_checker.sh'; then - echo "Cronjob already exists." -else - echo "Creating new cronjob..." - if { crontab -l; echo '0 10 * * * export TZ="Europe/Rome" && /root/scripts/quil_balance_checker.sh'; } | crontab -; then - echo "Cronjob created successfully." - else - echo "Failed to create cronjob." >&2 - exit 1 - fi -fi - -echo "Installer script executed successfully!"