arv-v-dsm/agent/agent.sh

31 lines
565 B
Bash
Raw Normal View History

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