mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 21:40:01 +08:00
28 lines
448 B
Bash
28 lines
448 B
Bash
|
#!/usr/bin/env bash
|
||
|
set -u
|
||
|
|
||
|
echo "Starting agent.."
|
||
|
|
||
|
chmod 666 /dev/ttyS0
|
||
|
echo "Starting agent.." > /dev/ttyS0
|
||
|
|
||
|
while true; do
|
||
|
|
||
|
sleep 1
|
||
|
|
||
|
result=$(cat /proc/interrupts | grep NMI)
|
||
|
result=$(echo $result | sed 's/[^0-9]*//g')
|
||
|
result=$(echo $result | sed 's/^0*//')
|
||
|
|
||
|
if [ "$result" != "" ]; then
|
||
|
|
||
|
echo "Received shutdown request.."
|
||
|
echo "Received shutdown request.." > /dev/ttyS0
|
||
|
|
||
|
/usr/syno/sbin/synopoweroff
|
||
|
exit
|
||
|
|
||
|
fi
|
||
|
|
||
|
done
|