Creating Suspend/Resume Related Services

I’m trying to implement a systemd service to trigger on device wake up after suspend. I’m following
Suspend/Resume (Linux) guide and the Apalis iMX8QM I’m using is not mentioned there. I was able use,

echo deep > /sys/power/mem_sleep; echo mem > /sys/power/state

commands suspend and WAKE1_MICO# pin to resume the device.

I’ve created a systemd service file as following at /etc/systemd/system as test_service.service.

Description=Test event trigger after resume


[Install] file is as following.

echo "hello world" >> /home/torizon/my_file.txt

I’ve added the service and enabled by following commands.

systemctl enable test_service.service
systemctl start test_service.service
systemctl daemon-reload

Unit works fine as it adds new data to text file when I manually start or restart the service. The service status shows as following.

test_service.service - Test event trigger after resume
Loaded: loaded (/etc/systemd/system/test_service.service; enabled; vendor preset: disabled)
Active: active (exited) since Thu 2022-12-22 03:02:51 UTC; 1h 9min ago
Process: 1357 ExecStart=/home/torizon/ (code=exited, status=0/SUCCESS)
Main PID: 1357 (code=exited, status=0/SUCCESS)

When I suspend the device and resume with gpio, service seems to be not triggered as no new data added to text file even after reboot. I’m running Torizoncore with following hardware.

Apalis iMX8QM 4GB WB IT v1.1 B
Ixora V1.1A

Any support is really appreciated. Thanks in advance.

Hi @imeshsps ,
Trying to reproduce the issue, allow us some time

Hi @imeshsps ,
I am able to reproduce the issue, could you test with "systemctl suspend".