Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Silvio Rhatto
Onionmine
Commits
c54169c3
Verified
Commit
c54169c3
authored
May 16, 2022
by
Silvio Rhatto
Browse files
Adds bin/mine-sync-to-remote-hosts (Closes #15)
parent
91a2203a
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
c54169c3
pools
onionmine.conf
bin/mkp224o
Makefile.local
Makefile
View file @
c54169c3
...
...
@@ -16,8 +16,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Include the environment file so Makefile to include custom configs and overrides
-include
.env
# Include the sample config
#-include onionmine.conf.sample
# Include the config file so Makefile includes custom configs and
# overrides
-include
onionmine.conf
# Provision the environment
provision
:
...
...
@@ -34,3 +38,6 @@ config:
# Start mining
mine
:
@
bin/mine
${pool}
# Include local targets
-include
Makefile.local
bin/mine-
remote
→
bin/mine-
sync-to-remote-hosts
View file @
c54169c3
...
...
@@ -24,11 +24,8 @@ DIRNAME="`dirname $0`"
source
$DIRNAME
/params
# Check
if
[
-z
"
$CONFIG
"
]
;
then
echo
"usage:
$BASENAME
<config-pool-name>"
exit
1
elif
[
!
-e
"
$FILTERS
"
]
;
then
echo
"
$BASENAME
: no such file
$FILTERS
"
if
[
-z
"
$REMOTE_HOSTS_RSYNC
"
]
||
[
"
$REMOTE_HOSTS_RSYNC
"
==
0
]
;
then
echo
"
$BASENAME
: please enable REMOTE_HOSTS_RSYNC at onionmine.conf"
exit
1
fi
...
...
@@ -38,15 +35,15 @@ if [ -z "$REMOTE_HOSTS" ]; then
exit
1
fi
# Check base dir
if
[
-z
"
$REMOTE_HOSTS_BASEDIR
"
]
;
then
echo
"
$BASENAME
: need to configure REMOTE_HOSTS_BASEDIR parameter"
exit
1
fi
# Iterate over all defined hosts
for
host
in
$REMOTE_HOSTS
;
do
# FIXME
#if [ ! -z "$REMOTE_HOSTS_RSYNC" ]; then
# true
#fi
# Connect to the remote host and start a mining operation
if
[
!
-z
"
$REMOTE_HOSTS_SSH_COMMAND
"
]
;
then
$REMOTE_HOSTS_SSH_COMMAND
$host
"make -C
$REMOTE_HOSTS_BASEDIR
mine pool=
$CONFIG
PASSPHRASE=
$PASSPHRASE
"
if
[
!
-z
"
$REMOTE_HOSTS_RSYNC
"
]
&&
[
"
$REMOTE_HOSTS_RSYNC
"
!=
0
]
;
then
$REMOTE_HOSTS_RSYNC_COMMAND
$RSYNC_EXCLUDES
$BASEDIR
/
$host
:
$REMOTE_HOSTS_BASEDIR
/
fi
done
bin/params
View file @
c54169c3
...
...
@@ -50,6 +50,15 @@ MKP224O_BUILD_FLAGS="--enable-intfilter=native"
# Default flags used for mkp224o invocation
MKP224O_RUN_FLAGS
=
"-s -d
$CANDIDATES
-f
$FILTERS
-B"
# Exclude the following patterns from syncing to remote hosts
RSYNC_EXCLUDES
=
"--exclude=candidates --exclude=daemon --exclude=checkpoint.save --exclude=passphrase --exclude=logs"
# Whether to sync the codebase to the remote hosts
REMOTE_HOSTS_RSYNC
=
"0"
# The rsync command to copy the codebase to the remote hosts
REMOTE_HOSTS_RSYNC_COMMAND
=
"rsync -avz --delete"
# Source the project-wide environment file
if
[
-e
"
$ENV
"
]
;
then
source
$ENV
...
...
onionmine.conf.sample
View file @
c54169c3
...
...
@@ -104,18 +104,18 @@ MKP224O_RUN_FLAGS="-s -d $CANDIDATES -f $FILTERS -B"
# A space-separated list of hostnames.
REMOTE_HOSTS=""
# Whether to sync the code
base
to the remote hosts
# Whether to sync the code
and pools
to the remote hosts
REMOTE_HOSTS_RSYNC="0"
# The rsync command to copy the codebase to the remote hosts
REMOTE_HOSTS_RSYNC_COMMAND=""
# The SSH command to connect to the remote hosts when invoking Onionmine scripts
REMOTE_HOSTS_SSH_COMMAND="ssh"
REMOTE_HOSTS_RSYNC_COMMAND="rsync -avz --delete"
# The remote basedir where the pool is located
REMOTE_HOSTS_BASEDIR="/home/onionmine/onionmine"
# Exclude the following patterns from syncing to remote hosts
RSYNC_EXCLUDES="--exclude=candidates --exclude=daemon --exclude=checkpoint.save --exclude=passphrase --exclude=logs"
#
# Other options
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment