Skip to content
Snippets Groups Projects
Verified Commit 15b57d24 authored by David Beniamine's avatar David Beniamine
Browse files

Fix reboot action

parent 4a792d6f
Branches
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
getip(){ getip(){
awk '/^lease/{IP=$2} /hardware ethernet/{gsub(";","",$3);if($3 == "'$1'"){print IP}}' \ awk '/^lease/{IP=$2} /hardware ethernet/{gsub(";","",$3);if($3 == "'$1'"){print IP}}' \
< /var/lib/dhcp/dhcpd.leases | sort -u < /var/lib/dhcp/dhcpd.leases
} }
# $1 : file|stdin # $1 : file|stdin
...@@ -101,12 +101,12 @@ do ...@@ -101,12 +101,12 @@ do
echo "Started 'upgrade_all.sh $subactions' in background on $(date)" | answer echo "Started 'upgrade_all.sh $subactions' in background on $(date)" | answer
elif [[ "$LINE" =~ "reboot" ]] elif [[ "$LINE" =~ "reboot" ]]
then then
mac=$(echo $line | cut -d ' ' -f 2) mac=$(echo $LINE | cut -d ' ' -f 2)
IPS=$(getip $mac | sed -e 's/ /,/g') IPS=$(getip $mac | sed -e 's/ /,/g')
for $ip in $IPS for ip in $IPS
do do
ssh $ip "reboot" ssh $ip "reboot"
done done
answer "Redémarrage demandé, attendez une à deux minutes avant d'essayer de vous connecter" echo "Redémarrage demandé, attendez une à deux minutes avant d'essayer de vous connecter" | answer
fi fi
done done
...@@ -140,12 +140,12 @@ if(!isset($action)){ ...@@ -140,12 +140,12 @@ if(!isset($action)){
?> ?>
<form action="index.php" method="post"> <form action="index.php" method="post">
<input type="hidden" name="action" value="wake"> <input type="hidden" name="action" value="wake">
<input type="hidden" name="mac" value="<?php echo $entry[1]; ?>"> <input type="hidden" name="name" value="<?php echo $entry[1]; ?>">
<input type="submit" value="Démarrer" title="Démarrer la machine"> <input type="submit" value="Démarrer" title="Démarrer la machine">
</form> </form>
<form action="index.php" method="post" onsubmit='return confirm("Êtes-vous sûr de vouloir redémarrer la machine <? echo $entry[2]; ?>");'> <form action="index.php" method="post" onsubmit='return confirm("Êtes-vous sûr de vouloir redémarrer la machine <? echo $entry[2]; ?>");'>
<input type="hidden" name="action" value="reboot"> <input type="hidden" name="action" value="reboot">
<input type="hidden" name="mac" value="<?php echo $entry[1]; ?>"> <input type="hidden" name="name" value="<?php echo $entry[1]; ?>">
<input type="submit" value="Redémarrer" title="redémarrer la machine"> <input type="submit" value="Redémarrer" title="redémarrer la machine">
</form> </form>
<form action="index.php" method="post"> <form action="index.php" method="post">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment