Keep script running while computer is in suspension mode

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question

















  • 2




    No, user space is frozen. See information about power states in documentation.
    – sebasth
    Sep 26 '17 at 13:35














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?










share|improve this question

















  • 2




    No, user space is frozen. See information about power states in documentation.
    – sebasth
    Sep 26 '17 at 13:35












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?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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












  • 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










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?






share|improve this answer






















  • 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










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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?






share|improve this answer






















  • 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














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?






share|improve this answer






















  • 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












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?






share|improve this answer














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?







share|improve this answer














share|improve this answer



share|improve this answer








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
















  • 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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?