Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
is it possible to run a script after resuming frm sleep mode
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 285

PostPosted: Wed May 04, 2016 2:16 pm    Post subject: is it possible to run a script after resuming frm sleep mode Reply with quote

hello,

I would like to run a script after i resume from sleep, to put back the hdparm parameters.

it should execute something like /etc/init.d/hdparm restart

How is this done using open-rc ?

i already typed: rc-update add hdparm default so at startup this works. But after resume i still have to type it in manually
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3129

PostPosted: Wed May 04, 2016 5:31 pm    Post subject: Reply with quote

It is possible
Quote:
# cat /etc/pm/sleep.d/hostapd
#! /bin/bash
if /etc/init.d/hostapd status
then /etc/init.d/hostapd restart
fi


"Restart hostapd if it was started before suspend"
Back to top
View user's profile Send private message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 285

PostPosted: Thu May 05, 2016 10:56 am    Post subject: Reply with quote

so i made a file

in /etc/pm/sleep.d/hdparm
Code:

#! /bin/bash
if /etc/init.d/hdparm status
then /etc/init.d/hdparm restart
fi

and chmod 777 hdparm

but it doesn't seem to work, what do i have to do more? to make this work automaticly after resume from sleep?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3129

PostPosted: Thu May 05, 2016 6:25 pm    Post subject: Reply with quote

First things first.... Is hdparm still in status "started" after suspend, or maybe it crashes? Do you even need to check it's status?
Is your trigger script launched?
Do you have... pm-utils?
Back to top
View user's profile Send private message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 285

PostPosted: Thu May 05, 2016 9:24 pm    Post subject: Reply with quote

Quote:
First things first.... Is hdparm still in status "started" after suspend, or maybe it crashes? Do you even need to check it's status?

Yes, it says started, but the hd spins down after resume from s2ram (it's not allowed to do that)
Quote:
Is your trigger script launched?

i have no idea, how can i check?

Quote:
Do you have... pm-utils?

sys-power/pm-utils 1.4.1-r6
sys-power/upower-pm-utils 0.9.23-r2

I'm using xfce4, Restart, shutdown,hybernate, suspend are greyed out( i' don't know why)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum