Skip to content

Instantly share code, notes, and snippets.

@mmastoras
Last active June 20, 2022 23:07
Show Gist options
  • Save mmastoras/b49d466579c97d36c83e9e008fa75f66 to your computer and use it in GitHub Desktop.
Save mmastoras/b49d466579c97d36c83e9e008fa75f66 to your computer and use it in GitHub Desktop.
dpkg lock
#!/bin/bash
apt-get update
apt-get install -y psmisc
i="0"
while [ $i -lt 10 ]
do
if [ $(fuser /var/lib/dpkg/lock) ]; then
i="0"
fi
sleep 1
i=$[$i+1]
done
@mmastoras
Copy link
Author

this will continue looping until dpkg lock is clear for 10 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment