diff --git a/shiny_version_check.sh b/shiny_version_check.sh new file mode 100755 index 0000000000000000000000000000000000000000..0c3e04e538b98d6f308b187153f5d471ff8f8730 --- /dev/null +++ b/shiny_version_check.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# check for new shiny version and download it if necessary + +#set -x +#trap read debug + +rawstring=$(curl -s https://rstudio.com/products/shiny/download-server/ubuntu/ |grep "wget.*amd64.deb") +prefix="<code>$ " +suffix="</code><br />" +noprefix=${rawstring#$prefix} +nosuffix=${noprefix%$suffix} +dlcommand="$nosuffix -q -P /home/monitoring/" +cur_version=$(shiny-server --version | head -n1 | cut -d "v" -f 3) +avail_version=$(cut -d "-" -f 4 <<< "$dlcommand") + +if [ "$avail_version" != "$cur_version" ] + then + if [ ! -e /home/monitoring/shiny-server-"${avail_version}"-amd64.deb ] + then + eval "$dlcommand" + fi + echo "Shiny version $avail_version available (in use $cur_version)" +fi +