virtual-dsm/agent/agent.sh

33 lines
574 B
Bash
Raw Normal View History

2023-04-01 18:43:53 +02:00
#!/usr/bin/env bash
set -u
echo "Starting agent.."
chmod 666 /dev/ttyS0
echo "Starting agent.." > /dev/ttyS0
2023-04-01 22:54:03 +02:00
sleep 5
2023-04-01 22:43:03 +02:00
echo "" > /dev/ttyS0
echo "You can now login to DSM at http://localhost:5000/" > /dev/ttyS0
echo "" > /dev/ttyS0
2023-04-01 18:43:53 +02:00
while true; do
sleep 1
result=$(cat /proc/interrupts | grep NMI)
2023-04-01 18:53:46 +02:00
result=$(echo "$result" | sed 's/[^0-9]*//g')
result=$(echo "$result" | sed 's/^0*//')
2023-04-01 18:43:53 +02:00
if [ "$result" != "" ]; then
echo "Received shutdown request.."
echo "Received shutdown request.." > /dev/ttyS0
/usr/syno/sbin/synopoweroff
exit
fi
done