2

I want to use my orange pi power button to suspend and resume system and have some troubles with check state. So I wrote shell script for this but it won't work; it's only suspending.

When I click the button in suspend mode, the resumed and suspends again in a few seconds. I can't find a way to resume it.

It seems likely that systemctl is-system-running is returning running in the suspended state. My script is:

#!/bin/sh
VALID_P=`systemctl is-system-running`
echo $VALID_P
if [ "$VALID_P" = "running" ]; then
    systemctl suspend
else
    systemctl default
fi
Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250

1 Answers1

2

In the end I used this script:

#!/bin/sh
file="/home/pi/loltest"
if [ -e "$file" ]
then
  rm /home/pi/loltest
else
  touch /home/pi/loltest
  systemctl suspend
fi

Works OK in armbian. I still have some problems with it in RetroArch or EmulationStation - they just hang after resume.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250