Created
May 30, 2019 05:41
-
-
Save vladkras/e83463e4a4c5d89ccfb932a1a0d61746 to your computer and use it in GitHub Desktop.
Ubuntu Linux auto update Skype™
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo chmod +x /path/to/skypeupdate.sh
sudo crontab -e
cause dpkg command requires root priveleges.
You can provide your own download link directly in cron without editing the script:
0 2 * * *
sets update at 2 a.m. Change it to suitable time.