Information on package downloads were obtained from the RStudio website, and this automation was prompted by a question asked by a student on GitHub.
I like to keep my automation scripts in ~/scripts
, but you may have a different personal preference. In any case, the script I wrote is as follows:
echo "Commencing RStudio update on" $(date +"%A %b %d, %Y") at $(date +"%r")
cd /home/shinshaw/Downloads
mkdir rstudio && cd rstudio
wget -O rstudio.deb http://www.rstudio.org/download/latest/preview/desktop/ubuntu64/rstudio-latest-amd64.deb
sudo dpkg -i rstudio.deb
cd /home/shinshaw/Downloads
rm -r rstudio/
Notes:
echo
messages to add any other useful information. If you'd like to check datetime language, run date --help
in terminal. Make sure the script you've saved is executable. For me, this was:
chmod +x ~/scripts/updateRstudio.sh
Next, you'll need to schedule this script to run at a given time. I've chosen to update my RStudio build at 4am on Sunday morning. This should make pretty certain that I'm not running into any errors. Now, it is very important that we access the root crontab scheduler, and not your personal crontab scheduler, as we'll be installing packages which requires elevated permissions. In terminal, type:
sudo crontab -e
This will open crontab in your default text editor, nano for me. In crontab, add a line such as:
00 04 * * 7 /home/shinshaw/scripts/updateRstudio.sh >> /home/shinshaw/scripts/logs/updateRstudio.log 2>&1
Let's work through this line:
00 04 * * 7
/home/shinshaw/scripts/updateRstudio.sh
>> /home/shinshaw/scripts/logs/updateRstudio.log 2>&1
~/scripts/logs/updateRstudio.log
, and 2>&1
tells it to include stderr as well. Then, save your crontab file and you're done! Congratulations!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.