Howto pause pm-suspend when program is running

I have a backintime running every hour. Sometimes, it’s running when I suspend/hibernate the machine. The suspend will fail, because backintime refuses to suspend. BIT will fail because network is pulled down. Then we have backintime running forever, and suspend/hibernate failing forever too(until you kill BIT manually).

This script will wait until backintime is done, and then let the computer suspend/hibernate.


case "${1}" in
    while pgrep -f "/usr/bin/backintime "; do
      sleep 5

exit 0

Remember to make the file executable.