forked from xmrig/xmrig
-
Notifications
You must be signed in to change notification settings - Fork 110
Useful scripts
VirtuBox edited this page Oct 22, 2018
·
5 revisions
#!/bin/bash
baseUrl="http://admin:pass@localhost:3344"
command="UPDATE_CONFIG"
curl "$baseUrl/admin/getClientStatusList" --silent | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/\042'client_id'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p | while read -r line ; do
curl -H "Content-Type: application/json" -X POST -d '{"control_command":{"command":"'$command'"}}' "$baseUrl/admin/setClientCommand?clientId=$line"
done
#!/bin/bash
baseUrl="http://admin:pass@localhost:3344"
curl "$baseUrl/admin/getClientStatusList" --silent | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/\042'client_id'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p | while read -r line ; do
echo $line
done
Create file /lib/systemd/system/xmrigcc.service (don't forget to change /path/to/your/xmrigDaemon)
[Unit]
Description=xmrigCC Daemon
[Service]
ExecStart=/path/to/your/xmrigDaemon
StandardOutput=null
[Install]
WantedBy=multi-user.target
Alias=xmrigcc.service
Then execute this commands to enable and start the service:
systemctl enable xmrigcc.service
systemctl start xmrigcc.service
Requirements : screen
- you can install it with apt install screen
if it's not available on your server.
Create a file /lib/systemd/system/xmrigCCServer.service
:
In the following example, replace YOUR_USER
with your linux user and set the proper path to xmrigCCServer.
[Unit]
Description=xmrigCCServer
After=network.target
[Service]
User=YOUR_USER
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S YOUR_USER /path/to/your/xmrigCCServer
ExecStop=/usr/bin/killall -w -s 2 /path/to/your/xmrigCCServer
WorkingDirectory=%h
[Install]
WantedBy=default.target
Then just enable it with :
systemctl enable xmrigCCServer.service
systemctl start xmrigCCServer