From 62fe8998b5497864d51ed0fe909a0ff60cc1520b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 16 Mar 2018 20:37:40 +0100 Subject: Make cpu limit for xmr stak parameter --- modules/profile/files/xmr_stak/xmr-stak.service | 15 --------------- modules/profile/manifests/xmr_stak.pp | 3 ++- modules/profile/templates/xmr_stak/xmr-stak.service.erb | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 modules/profile/files/xmr_stak/xmr-stak.service create mode 100644 modules/profile/templates/xmr_stak/xmr-stak.service.erb (limited to 'modules/profile') diff --git a/modules/profile/files/xmr_stak/xmr-stak.service b/modules/profile/files/xmr_stak/xmr-stak.service deleted file mode 100644 index 93ee383..0000000 --- a/modules/profile/files/xmr_stak/xmr-stak.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=XMR Miner -After=network.target - -[Service] -WorkingDirectory=/var/lib/xmr_stak - -Type=simple -User=xmr_stak -Group=xmr_stak -ExecStart=/usr/bin/cpulimit --limit 90 /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf -Nice=19 - -[Install] -WantedBy=multi-user.target diff --git a/modules/profile/manifests/xmr_stak.pp b/modules/profile/manifests/xmr_stak.pp index c8bbcdd..ccb6baa 100644 --- a/modules/profile/manifests/xmr_stak.pp +++ b/modules/profile/manifests/xmr_stak.pp @@ -1,6 +1,7 @@ class profile::xmr_stak ( String $mining_pool, String $wallet, + Optional[String] $cpulimit = "50", Optional[String] $password = "x", ) { ensure_resource('exec', 'systemctl daemon-reload', { @@ -25,7 +26,7 @@ class profile::xmr_stak ( mode => "0644", owner => "root", group => "root", - source => "puppet:///modules/profile/xmr_stak/xmr-stak.service", + content => template("profile/xmr_stak/xmr-stak.service.erb"), require => User["xmr_stak"], notify => Exec["systemctl daemon-reload"] } diff --git a/modules/profile/templates/xmr_stak/xmr-stak.service.erb b/modules/profile/templates/xmr_stak/xmr-stak.service.erb new file mode 100644 index 0000000..d63103b --- /dev/null +++ b/modules/profile/templates/xmr_stak/xmr-stak.service.erb @@ -0,0 +1,16 @@ +[Unit] +Description=XMR Miner +After=network.target + +[Service] +WorkingDirectory=/var/lib/xmr_stak + +Type=simple +User=xmr_stak +Group=xmr_stak +ExecStart=/usr/bin/cpulimit --limit <%= @cpulimit %> /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf +Nice=19 + +[Install] +WantedBy=multi-user.target + -- cgit v1.2.3