startup cleanup even after reordering
This commit is contained in:
parent
f10d0e51bb
commit
3581d8ec80
8
nlvmi
8
nlvmi
|
@ -150,7 +150,7 @@ function vmstart {
|
||||||
#prepare tmpfile
|
#prepare tmpfile
|
||||||
TMPF=/home/nlvmi/start${array[32]}-${array[1]}.tmp
|
TMPF=/home/nlvmi/start${array[32]}-${array[1]}.tmp
|
||||||
rm /home/nlvmi/start*-${array[1]}.tmp &>/dev/null
|
rm /home/nlvmi/start*-${array[1]}.tmp &>/dev/null
|
||||||
touch $TMPF && chmod 660 $TMPF
|
touch $TMPF && chmod 660 $TMPF && chown nlvmi: $TMPF
|
||||||
#add user if necessary
|
#add user if necessary
|
||||||
echo "if ! \`id -u ${array[2]} &>/dev/null\`; then useradd ${array[2]} -d /run/nlvmi -g nlvmi -M -s /bin/false -G kvm; fi" >>$TMPF
|
echo "if ! \`id -u ${array[2]} &>/dev/null\`; then useradd ${array[2]} -d /run/nlvmi -g nlvmi -M -s /bin/false -G kvm; fi" >>$TMPF
|
||||||
#chown mon and pid files
|
#chown mon and pid files
|
||||||
|
@ -188,10 +188,10 @@ function vmstart {
|
||||||
if [ ! -z "${array[35]}" ]; then
|
if [ ! -z "${array[35]}" ]; then
|
||||||
echo "chmod g+w $RUNDIRECTORY/${array[1]}.mon" >>$TMPF
|
echo "chmod g+w $RUNDIRECTORY/${array[1]}.mon" >>$TMPF
|
||||||
echo "chmod g+r $RUNDIRECTORY/${array[1]}.pid" >>$TMPF
|
echo "chmod g+r $RUNDIRECTORY/${array[1]}.pid" >>$TMPF
|
||||||
openssl dgst -sha512 -sign "/etc/nlvmi/nlvmi_priv.key" -out /home/nlvmi/${array[1]}.tmp.sha512 $TMPF
|
openssl dgst -sha512 -sign "/etc/nlvmi/nlvmi_priv.key" -out /home/nlvmi/start${array[32]}-${array[1]}.tmp.sha512 $TMPF
|
||||||
TMPFR="/home/nlvmi/rstart{array[32]}-${array[1]}.tmp"
|
TMPFR="/home/nlvmi/rstart${array[32]}-${array[1]}.tmp"
|
||||||
mv $TMPF $TMPFR
|
mv $TMPF $TMPFR
|
||||||
su nlvmi -c "ssh ${array[35]} \"rm /home/nlvmi/start*-${array[1]}.tmp\""
|
su nlvmi -c "ssh ${array[35]} \"rm /home/nlvmi/start*-${array[1]}.tmp*\""
|
||||||
mv $TMPFR $TMPF
|
mv $TMPFR $TMPF
|
||||||
su nlvmi -c "scp $TMPF* ${array[35]}:/home/nlvmi/"
|
su nlvmi -c "scp $TMPF* ${array[35]}:/home/nlvmi/"
|
||||||
su nlvmi -c "ssh ${array[35]} \"/usr/bin/nlvmi remote $TMPF run\""
|
su nlvmi -c "ssh ${array[35]} \"/usr/bin/nlvmi remote $TMPF run\""
|
||||||
|
|
Loading…
Reference in New Issue