import configparser | |
import random | |
# Generate a random number between 0 and 9999 | |
random_number = random.randint(0, 9999) | |
# Create a worker name with the random number | |
worker_name = f"worker_{random_number}" | |
# Load the config.ini file | |
config = configparser.ConfigParser() | |
config.read('config.ini') | |
# Update the rigName in the [Verushash] section | |
if 'Verushash' in config: | |
config['Verushash']['rigName'] = worker_name | |
else: | |
print("Verushash section not found in config.ini") | |
# Write the changes back to the config.ini file | |
with open('config.ini', 'w') as configfile: | |
config.write(configfile) | |
print(f"Updated rigName to {worker_name}") | |
# Optionally run your mining script | |
# import os | |
# os.system('bash cn.sh') | |