I have wakeup script that runs when the system wakes up (Arch linux)

$ cat /usr/lib/pm-utils/sleep.d/example

 case "$1" in
 echo "hey I just got resumed!"
/usr/bin/bash /home/user/bin/wakeup_script

my wakeup_script

$ cat bin/wakeup_script

/usr/bin/touch /home/user/testwake.txt
/usr/bin/rsync -vaz user@xx.xx.xx.xx:/home/user/downloads/test.txt /mnt/data/
/home/user/bin/mnt d

you can see that the script "wakeup_script" contains three bash script. When the system wakes up, the first and third script runs very well but rsync never worked, I tried scp, it doesn't work again! what's wrong here?

when I execute the same "wakeup_script" in a shell, the rsync does work but it doesn't get executed when the system wakes up!!

$ /usr/bin/bash /home/user/bin/wakeup_script
  • 2
    Does the rsync command rely on an SSH identity from your user's ~/.ssh? when run by root (from pm-utils) it will be looking in /root/.ssh instead – steeldriver Mar 17 at 12:35
  • Maybe network is not available yet? Try to redirect the output of your script to a file to investigate what goes wrong. /usr/bin/bash /home/user/bin/wakeup_script &> /tmp/wakeup.log – Thomas Mar 17 at 12:36
  • yes, it requires SSH key. How can I resolve this? – kuruvi Mar 17 at 14:20

In /usr/lib/pm-utils/sleep.d/example:

after the line:


add the line:

sleep 15

This will give 15 seconds for network interfaces to become available after resuming.

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.