I've bashed around on this one for awhile, no pun intended. I just want to open my todo list url in my browser every time my computer wakes from suspend. The command to do this normally is easy:

xdg-open https://complice.co/

...but that doesn't work, because "Please start Google Chrome as a normal user." Same if I try sensible-browser.

So then I try

sudo -H -u malcolm bash -c 'sensible-browser "https://complice.co/" >> "$LOGFILE"'

...and this totally works if I'm just in a terminal as root, but if I try to put it in a /etc/pm/sleep.d/ script, then it fails silently. I tried

sudo -H -u malcolm bash -c 'sleep 10; sensible-browser "https://complice.co/" >> "$LOGFILE"' 

...but it seems that the process is killed before sleep 10 finishes. (Based on trying sleep 10; echo "WAT" >> "$LOGFILE";)

This feels like it should be simple, but I'm pretty stuck.


What works for me is to place this script bellow into /etc/pm/sleep.d/ call it 70resumescript.sh, and give it executable permissions with sudo chmod +x scriptname.sh. In addition, I wrote the script with sudo nano scriptname.sh so that the script will be owned by root. So the script must have +x permission and be owned by root. Feel free to modify the scrip to suit your needs


case "$1" in
        # date >> /home/serg/LOG
        # echo "Script runs" >> /home/serg/LOG
        DISPLAY=:0 ; export DISPLAY
        sleep 4
        su serg -c 'firefox google.com'
  • If you like my answer, give me an upvote. Solved your problem ? Click the grey check-mark to accept my answer – Sergiy Kolodyazhnyy Jun 8 '15 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.