fix ssh user
This commit is contained in:
parent
e7351098ef
commit
cf1e0f7f5e
1 changed files with 5 additions and 5 deletions
|
@ -9,19 +9,19 @@ for TARGET in ${TARGETS}; do
|
||||||
for F in ${FILES}; do
|
for F in ${FILES}; do
|
||||||
#echo ${F}
|
#echo ${F}
|
||||||
EF="/etc/${F}"
|
EF="/etc/${F}"
|
||||||
scp -i ${ID} -q ${F} ${TARGET}:${EF}.new
|
scp -i ${ID} -q ${F} root@${TARGET}:${EF}.new
|
||||||
ssh -i ${ID} ${TARGET} "test -f ${EF} && diff -u ${EF} ${EF}.new"
|
ssh -i ${ID} root@${TARGET} "test -f ${EF} && diff -u ${EF} ${EF}.new"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
ssh -i ${ID} ${TARGET} "test -f ${EF} && mv ${EF} ${EF}.old; mv ${EF}.new ${EF}"
|
ssh -i ${ID} root@${TARGET} "test -f ${EF} && mv ${EF} ${EF}.old; mv ${EF}.new ${EF}"
|
||||||
CHANGED=1
|
CHANGED=1
|
||||||
else
|
else
|
||||||
ssh -i ${ID} ${TARGET} "rm ${EF}.new"
|
ssh -i ${ID} root@${TARGET} "rm ${EF}.new"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${CHANGED} == 1 ]; then
|
if [ ${CHANGED} == 1 ]; then
|
||||||
echo "Files changed, reloading ${TARGET}!";
|
echo "Files changed, reloading ${TARGET}!";
|
||||||
ssh -i ${ID} ${TARGET} "service pihole-FTL restart"
|
ssh -i ${ID} root@${TARGET} "service pihole-FTL restart"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Got an error code restarting pihole-FTL on ${TARGET}, exiting!"
|
echo "Got an error code restarting pihole-FTL on ${TARGET}, exiting!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue