Skip to content

Instantly share code, notes, and snippets.

@vladkras
Created May 30, 2019 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladkras/e83463e4a4c5d89ccfb932a1a0d61746 to your computer and use it in GitHub Desktop.
Save vladkras/e83463e4a4c5d89ccfb932a1a0d61746 to your computer and use it in GitHub Desktop.
Ubuntu Linux auto update Skype™
#! /bin/bash
DEB_FILE=/tmp/skype.deb
# remove old file if any
rm $DEB_FILE
# get download link
if [ -z "$1" ]; then
DOWNLOAD_LINK=https://go.skype.com/skypeforlinux-64.deb
else
DOWNLOAD_LINK="$1"
fi
# Download latest skype deb
wget -O $DEB_FILE $DOWNLOAD_LINK
# check file
if [ -f "$DEB_FILE" ]; then
# determine if skype is running
IS_RUNNING=$(pgrep skype | wc -l)
if [[ $IS_RUNNING -gt 0 ]]; then
# remember user & close skype
SKYPE_USER=$(ps -C skypeforlinux -o user= | head -1)
killall -9 skypeforlinux
fi
# install new skype
dpkg -i $DEB_FILE
if [[ $IS_RUNNING -gt 0 ]]; then
#start again
sudo -u $SKYPE_USER skypeforlinux
fi
else
echo "Cannot download .deb file"
exit 0
fi
@vladkras
Copy link
Author

vladkras commented May 30, 2019

  1. Download this file
  2. Make it executable sudo chmod +x /path/to/skypeupdate.sh
  3. Add this file to root cron sudo crontab -e
0 2 * * * /path/to/skypeupdate.sh

cause dpkg command requires root priveleges.

You can provide your own download link directly in cron without editing the script:

0 2 * * * /path/to/skypeupdate.sh https://another-download.link

0 2 * * * sets update at 2 a.m. Change it to suitable time.

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