Keep script running while computer is in suspension mode
Clash Royale CLAN TAG#URR8PPP
up vote
-2
down vote
favorite
The title says pretty much everything.
I'm using a simple script, launched when I start the X session, to check my battery level and, if it's below a fixed threshold, invoke systemctl hibernate
.
However, when I suspend the laptop with systemctl suspend
, the script obviously can't check the battery level. For this reason, it may happen that it shutdowns completely.
Is there any way to keep the script running even if the laptop is suspended?
shell-script suspend battery
add a comment |Â
up vote
-2
down vote
favorite
The title says pretty much everything.
I'm using a simple script, launched when I start the X session, to check my battery level and, if it's below a fixed threshold, invoke systemctl hibernate
.
However, when I suspend the laptop with systemctl suspend
, the script obviously can't check the battery level. For this reason, it may happen that it shutdowns completely.
Is there any way to keep the script running even if the laptop is suspended?
shell-script suspend battery
2
No, user space is frozen. See information about power states in documentation.
â sebasth
Sep 26 '17 at 13:35
add a comment |Â
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
The title says pretty much everything.
I'm using a simple script, launched when I start the X session, to check my battery level and, if it's below a fixed threshold, invoke systemctl hibernate
.
However, when I suspend the laptop with systemctl suspend
, the script obviously can't check the battery level. For this reason, it may happen that it shutdowns completely.
Is there any way to keep the script running even if the laptop is suspended?
shell-script suspend battery
The title says pretty much everything.
I'm using a simple script, launched when I start the X session, to check my battery level and, if it's below a fixed threshold, invoke systemctl hibernate
.
However, when I suspend the laptop with systemctl suspend
, the script obviously can't check the battery level. For this reason, it may happen that it shutdowns completely.
Is there any way to keep the script running even if the laptop is suspended?
shell-script suspend battery
shell-script suspend battery
asked Sep 26 '17 at 13:27
tigerjack89
1677
1677
2
No, user space is frozen. See information about power states in documentation.
â sebasth
Sep 26 '17 at 13:35
add a comment |Â
2
No, user space is frozen. See information about power states in documentation.
â sebasth
Sep 26 '17 at 13:35
2
2
No, user space is frozen. See information about power states in documentation.
â sebasth
Sep 26 '17 at 13:35
No, user space is frozen. See information about power states in documentation.
â sebasth
Sep 26 '17 at 13:35
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
No, when the system goes into hibernation or suspend mode, all user-level activity is suspended and will not resume until the system has left that mode. It is not possible to keep a script running (performing actions) during hibernation or suspension.
Related Ask Ubuntu question regarding "hybrid suspension" and "suspend to both RAM and disk": How do I use pm-suspend-hybrid by default instead of pm-suspend?
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
No, when the system goes into hibernation or suspend mode, all user-level activity is suspended and will not resume until the system has left that mode. It is not possible to keep a script running (performing actions) during hibernation or suspension.
Related Ask Ubuntu question regarding "hybrid suspension" and "suspend to both RAM and disk": How do I use pm-suspend-hybrid by default instead of pm-suspend?
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
add a comment |Â
up vote
5
down vote
No, when the system goes into hibernation or suspend mode, all user-level activity is suspended and will not resume until the system has left that mode. It is not possible to keep a script running (performing actions) during hibernation or suspension.
Related Ask Ubuntu question regarding "hybrid suspension" and "suspend to both RAM and disk": How do I use pm-suspend-hybrid by default instead of pm-suspend?
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
add a comment |Â
up vote
5
down vote
up vote
5
down vote
No, when the system goes into hibernation or suspend mode, all user-level activity is suspended and will not resume until the system has left that mode. It is not possible to keep a script running (performing actions) during hibernation or suspension.
Related Ask Ubuntu question regarding "hybrid suspension" and "suspend to both RAM and disk": How do I use pm-suspend-hybrid by default instead of pm-suspend?
No, when the system goes into hibernation or suspend mode, all user-level activity is suspended and will not resume until the system has left that mode. It is not possible to keep a script running (performing actions) during hibernation or suspension.
Related Ask Ubuntu question regarding "hybrid suspension" and "suspend to both RAM and disk": How do I use pm-suspend-hybrid by default instead of pm-suspend?
edited Sep 27 '17 at 7:02
answered Sep 26 '17 at 13:34
Kusalananda
106k14209327
106k14209327
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
add a comment |Â
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
Thanks for the info. So, how do other systems (Desktop Environments?) do that? I remember that when I had Ubuntu, when the laptop was suspended and the battery level dropped below a certain threshold, the system was resumed from suspension and immediately put to hibernation mode. Does this work in the kernel user space?
â tigerjack89
Sep 27 '17 at 6:55
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 I suspect that was something done by the kernel, not a user-level program. I'm unfamiliar with that particular feature of Ubuntu.
â Kusalananda
Sep 27 '17 at 6:58
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
@tigerjack89 See update.
â Kusalananda
Sep 27 '17 at 7:02
add a 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%2f394537%2fkeep-script-running-while-computer-is-in-suspension-mode%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
2
No, user space is frozen. See information about power states in documentation.
â sebasth
Sep 26 '17 at 13:35