How to make CouchPotato auto update to new release?

Typically CouchPotato update to new release is done manually but in this post I will show you how to make CouchPotato auto update itself on Linux. CouchPotato, an awesome little app that automates movie downloads, has been covered extensively by us, including installation (Windows / Ubuntu), configuration, and uninstallation. CouchPotato autoupdate can save time as it happens in the background without any user interaction. Plus, you will always have the latest and the greatest, including any security patches. So let us see how to enable CouchPotato auto update on Linux. [Read: 5 Best Usenet Search providers for Sick Beard and CouchPotato]

CouchPotato Update Notification

When an update is available, CouchPotato app notifies you by throwing a notification at the bottom of Couch Potato web interface.

Couchpotato Update Notification
Couchpotato Update Notification

Depending on how you configured CouchPotato, you may also receive an email notification to upgrade CouchPotato. [Read: Simplify downloading movies using CouchPotato Firefox plugin]

Couchpotato Upgrade Notification Email
Couchpotato Upgrade Notification Email

Then you login into your CouchPotato webui and click update. But what if you could auto update CouchPotato when updates are available without you doing anything?

Create CouchPotato Auto Update Script

As described in my CouchPotato installation guide, you can always stop CouchPotato, update it using the git pull, and restart it manually from the commandline. This process can be simplified by creating an update script.

ProviderRatingFeaturesMonthlyYearly
Newshosting
>3000 days, unlimited, SSL, VPN$9.99 $99.99 ($8.33 / month)
Editors Pick
UsenetServer
>3000 days, unlimited, SSL, VPN$9.99 $99.99 ($8.33 / month)
Eweka
>3000 days, unlimited, SSL, EU Servers€7,50 (Special!!!) 
For more plans that may fit your needs please read our Usenet plan selection guide.

Note that for this to work, you will have to have installed CouchPotato following our guide and your CouchPotato should be installed under .couchpotato in your home folder. If your CouchPotato app is installed in a different location then this should be reflected in the /etc/default/couchpotato file.

Create a file (using nano) or your favorite text editor and copy the following contents to it. Change USERNAME to your username. Save the file as couchpotato-updater.sh in your home folder (or anywhere you like).

#!/bin/bash
# CouchPotato Auto Update Script from htpcBeginner
sudo /etc/init.d/couchpotato stop
sleep 10
cd /home/USERNAME/.couchpotato
git pull
sudo /etc/init.d/couchpotato start

Basically, what this CouchPotato auto update script does is that it stops CouchPotato and moves to CouchPotato folder. Then issues the CouchPotato udpate git command to pull latest files and restarts CouchPotato. [Read: CouchPotato Chrome extension – easily add movies to download queue]

Next, cd in your home folder (or where you saved the file) and give the script execute permission using the following command:

sudo chmod 755 couchpotato-updater.sh

Now anytime you want to update CouchPotato, all your have to do is move to where the CouchPotato autoupdate script is saved and issue the following command:

sudo ./couchpotato-updater.sh

Don't ignore the sudo and the dot in the front. This is all fine and dandy but how do I auto upgrade CouchPotato? That's next. [Read: CouchPotato Apache reverse proxy]

Autorun CouchPotato Update using Cron

Webmin makes several system administration tasks easier, especially on a headless system. If you are not comfortable with commandline, I recommend installing and securing Webmin. You can create a cron job using Webmin interface to automatically run the CouchPotato auto update script at a set frequency. Go to System -> Scheduled Cron Jobs create a cron job as shown below.

Couchpotato Auto Update Cron
Couchpotato Auto Update Cron

In the example above, I am setting up the CouchPotato upgrade script to autorun at midnight. You could also do the same thing from commandline by creating a cron tab item, if you know what you are doing. Cron should email you the output of the command. If you find that annoying you may disable Cron email notifications.

That is all there is to it. Go ahead setup your CouchPotato auto update and get one step closer to completely automating your home server.

Be the 1 in 200,000. Help us sustain what we do.
113 / 150 by Dec 31, 2024
Join Us (starting from just $1.67/month)

Anand

Anand is a self-learned computer enthusiast, hopeless tinkerer (if it ain't broke, fix it), a part-time blogger, and a Scientist during the day. He has been blogging since 2010 on Linux, Ubuntu, Home/Media/File Servers, Smart Home Automation, and related HOW-TOs.

Try Deployarr