diff --git a/src/scripts/abc b/src/scripts/abc index cabaa0dc7f2..a973c330a01 100755 --- a/src/scripts/abc +++ b/src/scripts/abc @@ -22,7 +22,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset solr_hostname solr_port data_dir webapp_name user verbose +unset solr_hostname solr_port data_dir webapp_name user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -38,10 +38,11 @@ usage: $prog [-h hostname] [-p port] [-d dir] [-w webappname] [-u username] [-v] -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts h:p:d:w:u:v OPTION +while getopts h:p:d:w:u:vV OPTION do case $OPTION in h) @@ -62,12 +63,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${solr_port} ]] then echo "Solr port number missing in $confFile or command line." diff --git a/src/scripts/abo b/src/scripts/abo index 79afb62c798..c811177a648 100755 --- a/src/scripts/abo +++ b/src/scripts/abo @@ -22,7 +22,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset solr_hostname solr_port data_dir webapp_name user verbose +unset solr_hostname solr_port data_dir webapp_name user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -38,10 +38,11 @@ usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-v -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts h:p:d:w:u:v OPTION +while getopts h:p:d:w:u:vV OPTION do case $OPTION in h) @@ -62,12 +63,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${solr_port} ]] then echo "Solr port number missing in $confFile or command line." diff --git a/src/scripts/backup b/src/scripts/backup index 1b56b597a45..a109403f146 100755 --- a/src/scripts/backup +++ b/src/scripts/backup @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset data_dir user verbose +unset data_dir user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -34,10 +34,11 @@ usage: $prog [-d dir] [-u username] [-v] -d specify directory holding index data -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts d:u:v OPTION +while getopts d:u:vV OPTION do case $OPTION in d) @@ -49,12 +50,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + # use default value for data_dir if not specified # relative path starts at ${solr_root} if [[ -z ${data_dir} ]] diff --git a/src/scripts/backupcleaner b/src/scripts/backupcleaner index 3298803d1aa..8dc5c89abd2 100755 --- a/src/scripts/backupcleaner +++ b/src/scripts/backupcleaner @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset days num data_dir user verbose +unset days num data_dir user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -37,10 +37,11 @@ usage: $prog -D | -N [-d dir] [-u username] [-v] -d specify directory holding index data -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts D:N:d:u:v OPTION +while getopts D:N:d:u:vV OPTION do case $OPTION in D) @@ -58,12 +59,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${days} && -z ${num} ]] then echo "$USAGE" diff --git a/src/scripts/commit b/src/scripts/commit index 6f102d81da1..6351925f38b 100755 --- a/src/scripts/commit +++ b/src/scripts/commit @@ -22,7 +22,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset solr_hostname solr_port webapp_name user verbose +unset solr_hostname solr_port webapp_name user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -37,10 +37,11 @@ usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-v] -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts h:p:w:u:v OPTION +while getopts h:p:w:u:vV OPTION do case $OPTION in h) @@ -58,12 +59,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${solr_port} ]] then echo "Solr port number missing in $confFile or command line." diff --git a/src/scripts/optimize b/src/scripts/optimize index 1418833cb73..f3fa5e0186d 100755 --- a/src/scripts/optimize +++ b/src/scripts/optimize @@ -22,7 +22,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset solr_hostname solr_port webapp_name user verbose +unset solr_hostname solr_port webapp_name user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -37,11 +37,12 @@ usage: $prog [-h hostname] [-p port] [-u username] [-v] -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args originalargs="$@" -while getopts h:p:w:u:v OPTION +while getopts h:p:w:u:vV OPTION do case $OPTION in h) @@ -59,12 +60,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${solr_port} ]] then echo "Solr port number missing in $confFile or command line." diff --git a/src/scripts/readercycle b/src/scripts/readercycle index 9051de0e67c..a47a5d0067e 100755 --- a/src/scripts/readercycle +++ b/src/scripts/readercycle @@ -22,7 +22,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset solr_hostname solr_port webapp_name user verbose +unset solr_hostname solr_port webapp_name user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -37,11 +37,12 @@ usage: $prog [-p hostname] [-p port] [-w webapp_name] [-u username] [-v] -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args originalargs="$@" -while getopts h:p:w:u:v OPTION +while getopts h:p:w:u:vV OPTION do case $OPTION in h) @@ -59,12 +60,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${solr_port} ]] then echo "Solr port number missing in $confFile or command line." diff --git a/src/scripts/rsyncd-disable b/src/scripts/rsyncd-disable index 4d6bb39d843..b5b557e8869 100755 --- a/src/scripts/rsyncd-disable +++ b/src/scripts/rsyncd-disable @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset user verbose +unset user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -33,10 +33,11 @@ USAGE="\ usage: $prog [-u username] [-v] -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts u:v OPTION +while getopts u:vV OPTION do case $OPTION in u) @@ -45,12 +46,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" start=`date +"%s"` diff --git a/src/scripts/rsyncd-enable b/src/scripts/rsyncd-enable index 488145879f4..dcc6e4d7692 100755 --- a/src/scripts/rsyncd-enable +++ b/src/scripts/rsyncd-enable @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset user verbose +unset user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -32,10 +32,11 @@ USAGE="\ usage: $prog [-u username] [-v] -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts u:v OPTION +while getopts u:vV OPTION do case $OPTION in u) @@ -44,12 +45,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" start=`date +"%s"` diff --git a/src/scripts/rsyncd-start b/src/scripts/rsyncd-start index fb2cb418cbe..f12d50a5364 100755 --- a/src/scripts/rsyncd-start +++ b/src/scripts/rsyncd-start @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset data_dir solr_port rsyncd_port user verbose +unset data_dir solr_port rsyncd_port user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -35,10 +35,11 @@ usage: $prog [-d dir] [-p portnum] [-u username] [-v] -p specify rsyncd port number -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts d:p:u:v OPTION +while getopts d:p:u:vV OPTION do case $OPTION in d) @@ -53,12 +54,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" # try to determine rsyncd port number from $confFile if not specified on diff --git a/src/scripts/rsyncd-stop b/src/scripts/rsyncd-stop index 04177b371cd..5da8ba15d36 100755 --- a/src/scripts/rsyncd-stop +++ b/src/scripts/rsyncd-stop @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset user verbose +unset user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -33,10 +33,11 @@ USAGE="\ usage: $prog [-u username] [-v] -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts u:v OPTION +while getopts u:vV OPTION do case $OPTION in u) @@ -45,12 +46,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" logMessage stopped by $oldwhoami @@ -95,4 +101,4 @@ then fi # remove rsyncd.conf -/bin/rm -f ${solr_root}/conf/rsyncd.conf \ No newline at end of file +/bin/rm -f ${solr_root}/conf/rsyncd.conf diff --git a/src/scripts/scripts-util b/src/scripts/scripts-util index 7504138cacb..d5ce63fecfc 100755 --- a/src/scripts/scripts-util +++ b/src/scripts/scripts-util @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Shell script to disable rsyncd +# util functions used by scripts export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH diff --git a/src/scripts/snapcleaner b/src/scripts/snapcleaner index 9b1acad3cfb..9a89bcdec9a 100755 --- a/src/scripts/snapcleaner +++ b/src/scripts/snapcleaner @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset days num data_dir user verbose +unset days num data_dir user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -37,10 +37,11 @@ usage: $prog -D | -N [-d dir] [-u username] [-v] -d specify directory holding index data -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts D:N:d:u:v OPTION +while getopts D:N:d:u:vV OPTION do case $OPTION in D) @@ -58,12 +59,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${days} && -z ${num} ]] then echo "$USAGE" diff --git a/src/scripts/snapinstaller b/src/scripts/snapinstaller index 6e77f564d5d..ec352b73a15 100755 --- a/src/scripts/snapinstaller +++ b/src/scripts/snapinstaller @@ -22,7 +22,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset master_host master_status_dir data_dir user verbose +unset master_host master_status_dir data_dir user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -38,10 +38,11 @@ usage: $prog [-M master] [-S sdir] [-d dir] [-u username] [-v] -d specify directory holding index data on local machine -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts M:S:d:u:v OPTION +while getopts M:S:d:u:vV OPTION do case $OPTION in M) @@ -59,12 +60,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + if [[ -z ${master_host} ]] then echo "name of master server missing in $confFile or command line." diff --git a/src/scripts/snappuller b/src/scripts/snappuller index d22f8937b05..dd0dc4a5924 100755 --- a/src/scripts/snappuller +++ b/src/scripts/snappuller @@ -22,7 +22,7 @@ solr_root=$(pwd) cd ${orig_dir} unset master_host rsyncd_port master_data_dir master_status_dir snap_name -unset sizeonly stats data_dir user verbose compress startStatus +unset sizeonly stats data_dir user verbose debug compress startStatus . ${solr_root}/bin/scripts-util # set up variables @@ -43,11 +43,12 @@ usage: $prog [-M master] [-P portnum] [-D mdir] [-S sdir] [-n snapshot] [-d dir] -u specify user to sudo to before running script -s use the --size-only option with rsync -v increase verbosity (-vv show file transfer stats also) + -V output debugging info -z enable compression of data " # parse args -while getopts M:P:D:S:n:d:u:svz OPTION +while getopts M:P:D:S:n:d:u:svVz OPTION do case $OPTION in M) @@ -77,6 +78,9 @@ do v) [[ -n $verbose ]] && stats="--stats" || verbose=v ;; + V) + debug="V" + ;; z) compress="z" ;; @@ -86,6 +90,8 @@ do esac done +[[ -n $debug ]] && set -x + if [[ -z ${master_host} ]] then echo "name of master server missing in $confFile or command line." diff --git a/src/scripts/snappuller-disable b/src/scripts/snappuller-disable index aac98e66ee3..48da61d3b87 100755 --- a/src/scripts/snappuller-disable +++ b/src/scripts/snappuller-disable @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset user verbose +unset user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -33,10 +33,11 @@ USAGE="\ usage: $prog [-u username] [-v] -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts u:v OPTION +while getopts u:vV OPTION do case $OPTION in u) @@ -45,12 +46,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" start=`date +"%s"` diff --git a/src/scripts/snappuller-enable b/src/scripts/snappuller-enable index 9969f2763fc..af5a4c6e8f2 100755 --- a/src/scripts/snappuller-enable +++ b/src/scripts/snappuller-enable @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset user verbose +unset user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -33,10 +33,11 @@ USAGE="\ usage: $prog [-u username] [-v] -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts u:v OPTION +while getopts u:vV OPTION do case $OPTION in u) @@ -45,12 +46,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" start=`date +"%s"` diff --git a/src/scripts/snapshooter b/src/scripts/snapshooter index 172d55b8829..1932f0bc08a 100755 --- a/src/scripts/snapshooter +++ b/src/scripts/snapshooter @@ -21,7 +21,7 @@ cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} -unset data_dir user verbose +unset data_dir user verbose debug . ${solr_root}/bin/scripts-util # set up variables @@ -34,10 +34,11 @@ usage: $prog [-d dir] [-u username] [-v] -d specify directory holding index data -u specify user to sudo to before running script -v increase verbosity + -V output debugging info " # parse args -while getopts d:u:v OPTION +while getopts d:u:vV OPTION do case $OPTION in d) @@ -49,12 +50,17 @@ do v) verbose="v" ;; + V) + debug="V" + ;; *) echo "$USAGE" exit 1 esac done +[[ -n $debug ]] && set -x + fixUser "$@" # use default value for data_dir if not specified