What does `/usr/lib/pm-utils/sleep.d/94cpufreq` try to do?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq
(see the end of this post for its content.)
Is "$PM_FUNCTIONS"
a script, given that it is sourced by .
?
When I echo "$PM_FUNCTIONS"
in bash, it outputs nothing. Is PM_FUNCTIONS
defined in another script which calls the script?
Are savestate
, state_exists
, and restorestate
functions defined in "$PM_FUNCTIONS"
?
Is TEMPORARY_CPUFREQ_GOVERNOR"
a variable defined in "$PM_FUNCTIONS"
?
What does the script try to do upon suspend|hibernate
and upon thaw|resume
?
Thanks.
#!/bin/sh
# Ensure cpu governor is set to something sane.
# TODO: Which of the cpu governors is still insane? File bugs against
# those that are.
. "$PM_FUNCTIONS"
[ -d /sys/devices/system/cpu/ ] || exit $NA
hibernate_cpufreq()
thaw_cpufreq()
continue
restorestate "$x%%/*_governor" > "$x"
done )
case "$1" in
suspend|hibernate)
hibernate_cpufreq
;;
resume|thaw)
thaw_cpufreq
;;
*) exit $NA
;;
esac
bash shell-script cpu-frequency
add a comment |Â
up vote
3
down vote
favorite
On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq
(see the end of this post for its content.)
Is "$PM_FUNCTIONS"
a script, given that it is sourced by .
?
When I echo "$PM_FUNCTIONS"
in bash, it outputs nothing. Is PM_FUNCTIONS
defined in another script which calls the script?
Are savestate
, state_exists
, and restorestate
functions defined in "$PM_FUNCTIONS"
?
Is TEMPORARY_CPUFREQ_GOVERNOR"
a variable defined in "$PM_FUNCTIONS"
?
What does the script try to do upon suspend|hibernate
and upon thaw|resume
?
Thanks.
#!/bin/sh
# Ensure cpu governor is set to something sane.
# TODO: Which of the cpu governors is still insane? File bugs against
# those that are.
. "$PM_FUNCTIONS"
[ -d /sys/devices/system/cpu/ ] || exit $NA
hibernate_cpufreq()
thaw_cpufreq()
continue
restorestate "$x%%/*_governor" > "$x"
done )
case "$1" in
suspend|hibernate)
hibernate_cpufreq
;;
resume|thaw)
thaw_cpufreq
;;
*) exit $NA
;;
esac
bash shell-script cpu-frequency
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq
(see the end of this post for its content.)
Is "$PM_FUNCTIONS"
a script, given that it is sourced by .
?
When I echo "$PM_FUNCTIONS"
in bash, it outputs nothing. Is PM_FUNCTIONS
defined in another script which calls the script?
Are savestate
, state_exists
, and restorestate
functions defined in "$PM_FUNCTIONS"
?
Is TEMPORARY_CPUFREQ_GOVERNOR"
a variable defined in "$PM_FUNCTIONS"
?
What does the script try to do upon suspend|hibernate
and upon thaw|resume
?
Thanks.
#!/bin/sh
# Ensure cpu governor is set to something sane.
# TODO: Which of the cpu governors is still insane? File bugs against
# those that are.
. "$PM_FUNCTIONS"
[ -d /sys/devices/system/cpu/ ] || exit $NA
hibernate_cpufreq()
thaw_cpufreq()
continue
restorestate "$x%%/*_governor" > "$x"
done )
case "$1" in
suspend|hibernate)
hibernate_cpufreq
;;
resume|thaw)
thaw_cpufreq
;;
*) exit $NA
;;
esac
bash shell-script cpu-frequency
On my Ubuntu 16.04, I am trying to understand a system default file /usr/lib/pm-utils/sleep.d/94cpufreq
(see the end of this post for its content.)
Is "$PM_FUNCTIONS"
a script, given that it is sourced by .
?
When I echo "$PM_FUNCTIONS"
in bash, it outputs nothing. Is PM_FUNCTIONS
defined in another script which calls the script?
Are savestate
, state_exists
, and restorestate
functions defined in "$PM_FUNCTIONS"
?
Is TEMPORARY_CPUFREQ_GOVERNOR"
a variable defined in "$PM_FUNCTIONS"
?
What does the script try to do upon suspend|hibernate
and upon thaw|resume
?
Thanks.
#!/bin/sh
# Ensure cpu governor is set to something sane.
# TODO: Which of the cpu governors is still insane? File bugs against
# those that are.
. "$PM_FUNCTIONS"
[ -d /sys/devices/system/cpu/ ] || exit $NA
hibernate_cpufreq()
thaw_cpufreq()
continue
restorestate "$x%%/*_governor" > "$x"
done )
case "$1" in
suspend|hibernate)
hibernate_cpufreq
;;
resume|thaw)
thaw_cpufreq
;;
*) exit $NA
;;
esac
bash shell-script cpu-frequency
edited Apr 2 at 23:09
asked Apr 2 at 23:03
Tim
22.6k63224401
22.6k63224401
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
The functions state_exists
, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS
refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR
is defined in PM_FUNCTIONS
.
Thanks. How did you find them out by just looking at the file system? Where isPM_FUNCTIONS
defined? How shall I find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called?
â Tim
Apr 2 at 23:30
You can find filenames usingfind
orlocate
and then search the files using grep. For instance, to search for the variableTEMPORARY_CPUFREQ_GOVERNOR
you can use the commandgrep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
Thanks. I was wondering how to find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called? Under/usr/lib/pm-utils/
, I rungrep -R freq .
, and it only return the file/usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I rungrep -R sleep.d .
, and it returns nothing useful either.
â Tim
Apr 2 at 23:39
They are hooks that are run in the function_run_hooks()
from the filepm-functions
. Note the part that looks like this:for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?
â J. Taylor
Apr 3 at 0:14
By the way, to find that, I usedgrep
as follows:grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this:usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because sincesleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
â J. Taylor
Apr 3 at 0:22
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
The functions state_exists
, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS
refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR
is defined in PM_FUNCTIONS
.
Thanks. How did you find them out by just looking at the file system? Where isPM_FUNCTIONS
defined? How shall I find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called?
â Tim
Apr 2 at 23:30
You can find filenames usingfind
orlocate
and then search the files using grep. For instance, to search for the variableTEMPORARY_CPUFREQ_GOVERNOR
you can use the commandgrep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
Thanks. I was wondering how to find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called? Under/usr/lib/pm-utils/
, I rungrep -R freq .
, and it only return the file/usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I rungrep -R sleep.d .
, and it returns nothing useful either.
â Tim
Apr 2 at 23:39
They are hooks that are run in the function_run_hooks()
from the filepm-functions
. Note the part that looks like this:for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?
â J. Taylor
Apr 3 at 0:14
By the way, to find that, I usedgrep
as follows:grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this:usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because sincesleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
â J. Taylor
Apr 3 at 0:22
 |Â
show 1 more comment
up vote
2
down vote
The functions state_exists
, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS
refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR
is defined in PM_FUNCTIONS
.
Thanks. How did you find them out by just looking at the file system? Where isPM_FUNCTIONS
defined? How shall I find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called?
â Tim
Apr 2 at 23:30
You can find filenames usingfind
orlocate
and then search the files using grep. For instance, to search for the variableTEMPORARY_CPUFREQ_GOVERNOR
you can use the commandgrep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
Thanks. I was wondering how to find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called? Under/usr/lib/pm-utils/
, I rungrep -R freq .
, and it only return the file/usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I rungrep -R sleep.d .
, and it returns nothing useful either.
â Tim
Apr 2 at 23:39
They are hooks that are run in the function_run_hooks()
from the filepm-functions
. Note the part that looks like this:for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?
â J. Taylor
Apr 3 at 0:14
By the way, to find that, I usedgrep
as follows:grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this:usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because sincesleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
â J. Taylor
Apr 3 at 0:22
 |Â
show 1 more comment
up vote
2
down vote
up vote
2
down vote
The functions state_exists
, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS
refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR
is defined in PM_FUNCTIONS
.
The functions state_exists
, etc are defined in /usr/lib/pm-utils/functions and PM_FUNCTIONS
refers to the script /usr/lib/pm-utils/pm-functions. And yes, TEMPORARY_CPUFREQ_GOVERNOR
is defined in PM_FUNCTIONS
.
answered Apr 2 at 23:24
J. Taylor
1,60211322
1,60211322
Thanks. How did you find them out by just looking at the file system? Where isPM_FUNCTIONS
defined? How shall I find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called?
â Tim
Apr 2 at 23:30
You can find filenames usingfind
orlocate
and then search the files using grep. For instance, to search for the variableTEMPORARY_CPUFREQ_GOVERNOR
you can use the commandgrep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
Thanks. I was wondering how to find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called? Under/usr/lib/pm-utils/
, I rungrep -R freq .
, and it only return the file/usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I rungrep -R sleep.d .
, and it returns nothing useful either.
â Tim
Apr 2 at 23:39
They are hooks that are run in the function_run_hooks()
from the filepm-functions
. Note the part that looks like this:for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?
â J. Taylor
Apr 3 at 0:14
By the way, to find that, I usedgrep
as follows:grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this:usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because sincesleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
â J. Taylor
Apr 3 at 0:22
 |Â
show 1 more comment
Thanks. How did you find them out by just looking at the file system? Where isPM_FUNCTIONS
defined? How shall I find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called?
â Tim
Apr 2 at 23:30
You can find filenames usingfind
orlocate
and then search the files using grep. For instance, to search for the variableTEMPORARY_CPUFREQ_GOVERNOR
you can use the commandgrep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
Thanks. I was wondering how to find out where/usr/lib/pm-utils/sleep.d/94cpufreq
and/etc/pm/sleep.d/20_cpu_freq
are called? Under/usr/lib/pm-utils/
, I rungrep -R freq .
, and it only return the file/usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I rungrep -R sleep.d .
, and it returns nothing useful either.
â Tim
Apr 2 at 23:39
They are hooks that are run in the function_run_hooks()
from the filepm-functions
. Note the part that looks like this:for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?
â J. Taylor
Apr 3 at 0:14
By the way, to find that, I usedgrep
as follows:grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this:usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because sincesleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.
â J. Taylor
Apr 3 at 0:22
Thanks. How did you find them out by just looking at the file system? Where is
PM_FUNCTIONS
defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq
and /etc/pm/sleep.d/20_cpu_freq
are called?â Tim
Apr 2 at 23:30
Thanks. How did you find them out by just looking at the file system? Where is
PM_FUNCTIONS
defined? How shall I find out where /usr/lib/pm-utils/sleep.d/94cpufreq
and /etc/pm/sleep.d/20_cpu_freq
are called?â Tim
Apr 2 at 23:30
You can find filenames using
find
or locate
and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR
you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
You can find filenames using
find
or locate
and then search the files using grep. For instance, to search for the variable TEMPORARY_CPUFREQ_GOVERNOR
you can use the command grep -ri "TEMPORARY_CPUFREQ_GOVERNOR" /usr/lib/pm-utils
â J. Taylor
Apr 2 at 23:36
Thanks. I was wondering how to find out where
/usr/lib/pm-utils/sleep.d/94cpufreq
and /etc/pm/sleep.d/20_cpu_freq
are called? Under /usr/lib/pm-utils/
, I run grep -R freq .
, and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I run grep -R sleep.d .
, and it returns nothing useful either.â Tim
Apr 2 at 23:39
Thanks. I was wondering how to find out where
/usr/lib/pm-utils/sleep.d/94cpufreq
and /etc/pm/sleep.d/20_cpu_freq
are called? Under /usr/lib/pm-utils/
, I run grep -R freq .
, and it only return the file /usr/lib/pm-utils/sleep.d/94cpufreq
, which is meaningless. I run grep -R sleep.d .
, and it returns nothing useful either.â Tim
Apr 2 at 23:39
They are hooks that are run in the function
_run_hooks()
from the file pm-functions
. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?â J. Taylor
Apr 3 at 0:14
They are hooks that are run in the function
_run_hooks()
from the file pm-functions
. Note the part that looks like this: for base in $(IFS="$oifs"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; do [ -O "$f" ] && echo $f##*/ ; done | $sort | uniq) ;
... See How do I run commands on suspend/return from suspend?â J. Taylor
Apr 3 at 0:14
By the way, to find that, I used
grep
as follows: grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because since sleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.â J. Taylor
Apr 3 at 0:22
By the way, to find that, I used
grep
as follows: grep -ri '.d' /usr/lib/pm-utils/
, which returned a couple of lines that looked like this: usr/lib/pm-utils/pm-functions: local syshooks="$PM_UTILS_ETCDIR/$1.d"
I searched for ".d" in because since sleep.d
wasn't showing up explicitly, I figured there was some kind of loop that went through all of the ".d" directories.â J. Taylor
Apr 3 at 0:22
 |Â
show 1 more comment
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435150%2fwhat-does-usr-lib-pm-utils-sleep-d-94cpufreq-try-to-do%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password