[SOLVED]run script on wake up from sleep

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED]run script on wake up from sleep

Postby nexus » May 13th, '23, 16:10

Hello,
what is right way to run script on wake up from sleep on Mageia 5?
I created a script named 99test
Code: Select all
#!/bin/sh

case "$1" in
   hibernate|suspend)
      ;;
   thaw|resume)
      touch /home/test.txt
      ;;
   *) exit $NA
      ;;
esac

and I put it in two places:
/usr/lib64/pm-utils/sleep.d/
and
/etc/pm/sleep.d/
but without success. File test.txt not was created after wake up from sleep.
Last edited by nexus on May 15th, '23, 20:48, edited 1 time in total.
nexus
 
Posts: 36
Joined: Jan 16th, '18, 16:05

Re: run script on wake up from sleep

Postby morgano » May 13th, '23, 18:26

This question is not my cup of tea.

But why are you on Mageia *5* ?
It is since long not supported.
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1489
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: run script on wake up from sleep

Postby nexus » May 13th, '23, 22:08

Mageia 5 is the last version that has the functionality what I need (more here viewtopic.php?f=7&t=14188).
But maybe the same method will work like in Mageia 8.
nexus
 
Posts: 36
Joined: Jan 16th, '18, 16:05

Re: run script on wake up from sleep

Postby doktor5000 » May 14th, '23, 16:19

Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18045
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: run script on wake up from sleep

Postby nexus » May 15th, '23, 00:19

I created file:
/etc/systemd/system/root-resume.service
Code: Select all
[Unit]
Description=Local system resume actions
After=suspend.target

[Service]
Type=simple
ExecStart=/bin/touch /home/test.txt

[Install]
WantedBy=suspend.target
run command:
systemctl enable root-resume.service
and... it work.
Thank you very much
nexus
 
Posts: 36
Joined: Jan 16th, '18, 16:05

Re: run script on wake up from sleep

Postby doktor5000 » May 15th, '23, 16:14

Please don't forget to mark the thread as solved, by editing the subject of the first post and prefix it with [SOLVED], thanks in advance.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18045
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Basic support

Who is online

Users browsing this forum: Google [Bot] and 1 guest