Script to execute specifically on login from suspend on 16.04

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
2
down vote

favorite












I have a script that sets up my mouse preferences and it’s placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesn’t seem to be the same as a regular login, as it doesn’t execute .profile or .bashrc.



I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesn’t seem that xinput commands work at that point in the wake up cycle because the changes don’t take effect.



So I’m either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.







share|improve this question






















  • Can you give example of his you are using xinput command?
    – WinEunuuchs2Unix
    May 18 at 21:20










  • Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
    – Sam Thibodeau
    May 22 at 18:17










  • You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
    – WinEunuuchs2Unix
    May 22 at 18:36














up vote
2
down vote

favorite












I have a script that sets up my mouse preferences and it’s placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesn’t seem to be the same as a regular login, as it doesn’t execute .profile or .bashrc.



I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesn’t seem that xinput commands work at that point in the wake up cycle because the changes don’t take effect.



So I’m either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.







share|improve this question






















  • Can you give example of his you are using xinput command?
    – WinEunuuchs2Unix
    May 18 at 21:20










  • Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
    – Sam Thibodeau
    May 22 at 18:17










  • You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
    – WinEunuuchs2Unix
    May 22 at 18:36












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have a script that sets up my mouse preferences and it’s placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesn’t seem to be the same as a regular login, as it doesn’t execute .profile or .bashrc.



I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesn’t seem that xinput commands work at that point in the wake up cycle because the changes don’t take effect.



So I’m either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.







share|improve this question














I have a script that sets up my mouse preferences and it’s placed in Startup applications. It runs on startup, but when the lid is closed or the computer manually put in suspend (same thing really), the settings get removed. I have it so Ubuntu requires my password on return from suspend, but this login doesn’t seem to be the same as a regular login, as it doesn’t execute .profile or .bashrc.



I tried placing my script in /lib/systemd/system-sleep/ but this executes before entering my password and it doesn’t seem that xinput commands work at that point in the wake up cycle because the changes don’t take effect.



So I’m either looking for a way to make every suspend also execute a lock or log off cycle (as locking manually executes .profile) or find a way to execute a script specifically on the password entry on resume from suspend.









share|improve this question













share|improve this question




share|improve this question








edited May 18 at 15:48









Zanna

47.9k13117227




47.9k13117227










asked May 18 at 15:29









Sam Thibodeau

111




111











  • Can you give example of his you are using xinput command?
    – WinEunuuchs2Unix
    May 18 at 21:20










  • Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
    – Sam Thibodeau
    May 22 at 18:17










  • You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
    – WinEunuuchs2Unix
    May 22 at 18:36
















  • Can you give example of his you are using xinput command?
    – WinEunuuchs2Unix
    May 18 at 21:20










  • Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
    – Sam Thibodeau
    May 22 at 18:17










  • You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
    – WinEunuuchs2Unix
    May 22 at 18:36















Can you give example of his you are using xinput command?
– WinEunuuchs2Unix
May 18 at 21:20




Can you give example of his you are using xinput command?
– WinEunuuchs2Unix
May 18 at 21:20












Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
– Sam Thibodeau
May 22 at 18:17




Yeah, one of the lines in the script is "xinput --set-prop 12 291 -1". This sets the acceleration (option 291) of the trackpad (input 12) to -1 (so no acceleration). I had a script in /lib/systemd/system-sleep/ that would print text to a file on wakeup. It would work fine, but as soon as I added the xinput commands, the script would crash and not finish (I had two echo "text" >> test.txt commands sandwiching the xinput commands. The second wouldn't complete when the xinput commnds were added to the script).
– Sam Thibodeau
May 22 at 18:17












You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
– WinEunuuchs2Unix
May 22 at 18:36




You should post the script into your question. Then people answering can use your script setup rather than their own. For example mine would be with WiFi or Ethernet kernel modules reloading after sleep.
– WinEunuuchs2Unix
May 22 at 18:36















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
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: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f1037812%2fscript-to-execute-specifically-on-login-from-suspend-on-16-04%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037812%2fscript-to-execute-specifically-on-login-from-suspend-on-16-04%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Unable to execute new pre-installation script (/var/lib/dpkg/tmp.ci/preinst)

Running the scala interactive shell from the command line

Do not install recommended packages of dependencies