Commit 4e5d2985 authored by Jondy Zhao's avatar Jondy Zhao

Fix autorebase.bat doesn't support multi-nodes

parent c98cee00
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
# #
function show_error_exit() function show_error_exit()
{ {
echo Error: ${1-Run post-install script failed.} echo Error: ${1:-"Run post-install script failed."}
read -n 1 -p "Press any key to exit..." read -n 1 -p "Press any key to exit..."
exit 1 exit 1
} }
readonly -f show_error_exit readonly -f show_error_exit
declare -r cyghome=$(cygpath -w /)
declare -r slapos_prefix=$1 declare -r slapos_prefix=$1
declare -r _cygroot=$(cygpath -w /)
_filename=/etc/passwd _filename=/etc/passwd
echo "Checking ${_filename} ..." echo "Checking ${_filename} ..."
...@@ -81,8 +81,8 @@ if [[ ! -x ${_filename} ]] ; then ...@@ -81,8 +81,8 @@ if [[ ! -x ${_filename} ]] ; then
cat <<EOF > ${_filename} cat <<EOF > ${_filename}
@echo off @echo off
${cyghome:0:2} ${_cygroot:0:2}
chdir ${cyghome}\\bin chdir ${_cygroot}\\bin
start mintty.exe -i /Cygwin-Terminal.ico - start mintty.exe -i /Cygwin-Terminal.ico -
EOF EOF
...@@ -97,19 +97,20 @@ echo Checking ${_filename} ... ...@@ -97,19 +97,20 @@ echo Checking ${_filename} ...
if [[ ! -f ${_filename} ]] ; then if [[ ! -f ${_filename} ]] ; then
cat <<EOF > ${_filename} cat <<EOF > ${_filename}
@echo off @echo off
${cyghome}\bin\find /opt/slapos -name "*.dll" > ${cyghome}\myfile.list ${_cygroot:0:2}
IF EXIST ${cyghome}\opt\slapgrid. ${cyghome}\bin\find /opt/slapgrid -name "*.dll" >> ${cyghome}\myfile.list CHDIR ${_cygroot}
TASKKILL /F /IM openvpn.exe ${_cygroot}\bin\find /opt/slapos -name "*.dll" > ${_cygroot}\myfile.list
NET STOP re6stnet IF EXIST ${_cygroot}\opt\slapgrid. ${_cygroot}\bin\find /opt/slapgrid -name "*.dll" >> ${_cygroot}\myfile.list
NET STOP cygserver bin\bash --login -c "for pid in \$(ps | grep '/usr/bin/openvpn' | gawk '{print $4}') ; do TASKKILL /F /T /PID \$pid ; done"
NET STOP syslog-ng NET STOP ${slapos_prefix}re6stnet
NET STOP cron NET STOP ${slapos_prefix}cygserver
NET STOP sshd NET STOP ${slapos_prefix}syslog-ng
TASKKILL /F /IM python2.7.exe NET STOP ${slapos_prefix}cron
${cyghome:0:2} NET STOP ${slapos_prefix}sshd
chdir ${cyghome} bin\bash --login -c "for pid in \$(ps | grep '/usr/bin/python2.7' | gawk '{print \$4}') ; do TASKKILL /F /T /PID \$pid ; done"
path .\bin;%path% PATH .\bin;%PATH%
dash /bin/rebaseall -T /myfile.list -v dash /bin/rebaseall -T /myfile.list -v
EXIT 0
EOF EOF
chmod +x ${_filename} chmod +x ${_filename}
echo "${_filename} has been generated." echo "${_filename} has been generated."
......
...@@ -56,6 +56,7 @@ function show_usage() ...@@ -56,6 +56,7 @@ function show_usage()
echo " cron Generate cron file and start cron job" echo " cron Generate cron file and start cron job"
echo "" echo ""
} }
readonly -f show_usage
source $(/usr/bin/dirname $0)/slapos-include.sh source $(/usr/bin/dirname $0)/slapos-include.sh
csih_inform "Start slapos node configure ..." csih_inform "Start slapos node configure ..."
......
Markdown is supported
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