-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathforkfixconfigq
101 lines (91 loc) · 4.84 KB
/
forkfixconfigq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#! /usr/bin/env bash
function print_usage () {
echo "forkfixconfig help:"
echo
echo "SYNOPSIS: Automatically edits config.yaml files for certain values that can be useful to"
echo " customize. The settings to be applied can be customized in ftconfigs/config.forkfixconfig."
echo " Parameters that can be automatically set by forkfixconfig are log_level,"
echo " log_maxfilesrotation, plot_load_frequency (forkfixconfig will edit interval_seconds"
echo " instead if the fork uses that newer parameter), batch_size, batch_sleep_milliseconds,"
echo " upnp_enabled, parallel_read (only useful to MacOS X users using exfat drives),"
echo " db_sync setting for both main and wallet dbs, and target_peer_count."
echo " 'farmer_peer host:' can also be passed as a parameter for pure harvesters."
echo " forkfixconfig can even add multiprocessing_limit, a fork-only parameter"
echo " created by grayfallstown that some forks have implemented which limits the number of"
echo " fullnode workers created in order to save memory. The normal limit, which is"
echo " dependent on number of CPU cores, is fine when doing a full sync from scratch, but overkill"
echo " once full sync has been achieved. In order to not accidentally cripple a fork's ability"
echo " to achieve full sync on a new install, forkfixconfig will not add this parameter to"
echo " a config until the fork is confirmed by forkfixconfig as being fully synced."
echo " Running 'forkfixconfig all' will attempt to set configs for every fork with a"
echo " -blockchain directory and a config.yaml in the fork's hidden directory. Confirmation"
echo " for each fork will be asked before applying the proposed changes."
echo " forkfixconfig now supports fork-specific configurations. If you want to have"
echo " different settings for a specific fork, simply copy config.forkfixconfig to"
echo " config.forkfixconfig.forkname and edit the settings you want for that forkname."
echo " forkstart should be run for forks after these changes in order to make the new"
echo " config settings actually take effect."
echo
echo "PARAMETERS:"
echo " forkname | farmers | harvesters | all"
echo " Required. Only choose one. Must be first parameter."
echo " 'forkname' runs for that single fork."
echo " 'farmers' runs only for forks with an active farmer process."
echo " 'harvesters' runs only for forks with an active harvester process"
echo " but not an active farmer process. Only pure harvesters."
echo " 'all' runs for every fork with a -blockchain directory and a config."
echo " Farmer IP OPTIONAL second parameter. Use only for pure harvester configs."
echo " Sets 'host:' under 'farmer_peer' in the harvester section of"
echo " the config to the address of the server running farmer services"
echo " for that fork."
echo " For example, pass 10.0.0.100 as the second parameter, but use the"
echo " IP address of the farmer for the fork on your local network."
echo " -help | --help Show this information again."
echo
exit 0
}
if [[ $3 != '' ]]; then
echo "forkstop: Too many specified parameters."
print_usage
fi
if [[ $1 != 'all' && $1 != 'farmers' && $1 != 'harvesters' ]]; then
VALIDATEFORKNAME='Yes'
fi
. ftinit.sh
. $FORKTOOLSDIR/ftbuildrunlists.sh
if [[ $1 == 'all' ]]; then
cd $FORKTOOLSBLOCKCHAINDIRS
FORKLIST=$( ls -d1 *-blockchain | sed 's/-blockchain//' )
else
if [[ $1 == 'farmers' ]]; then
FORKLIST=$FARMERLIST
elif [[ $1 == 'harvesters' ]]; then
FORKLIST=$HARVESTERLIST
for fork in $FARMERLIST; do
OLDIFS=$IFS
IFS=''
FORKLIST=$(echo $FORKLIST | sed "/^$fork$/d" )
IFS=$OLDIFS
done
else
FORKLIST=$1
fi
fi
SETFARMERPEER=$2
for FORKNAME in $FORKLIST; do
CURRENTCONFIG=$FORKTOOLSHIDDENDIRS/.$FORKNAME/mainnet/config/config.yaml
if [[ ! -f $CURRENTCONFIG ]]; then
continue
fi
echo
echo "forkfixconfig $FORKNAME: Analyzing $CURRENTCONFIG."
. ftfixconfig.sh
done
echo
if [[ $FTBASECOMMAND == 'forkfixconfig' ]]; then
if [[ $1 == 'all' ]]; then
echo "'forkfixconfig all' complete. Remember to restart services ('forkstart all -s 30', as an example, to get a 30 second delay between restarts) for any changes to take effect."
elif [[ $REPLY =~ ^[Yy]$ ]]; then
echo "'forkfixconfig $1' complete. Remember to restart services ('forkstart $1 -f|-fnw|-h') for the changes to take effect."
fi
fi