Verified Commit c54169c3 authored by Silvio Rhatto's avatar Silvio Rhatto
Browse files

Adds bin/mine-sync-to-remote-hosts (Closes #15)

parent 91a2203a
pools
onionmine.conf
bin/mkp224o
Makefile.local
......@@ -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
......@@ -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
......@@ -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
......
......@@ -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 codebase 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
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment