-
Notifications
You must be signed in to change notification settings - Fork 147
Ubuntu: Run plexupdate.sh from cron
Please use installer.sh
found under extras/
which will do this for you and also guide you through the process so you get automatic updates, etc.
Some assumptions, which MUST be replaced with correct values for your system:
- Your username on your machine is
john
- You want to download and install the latest plex every week if one is available
- You don't want to keep the downloaded packages
- Your account on https://plex.tv is:
- email:
[email protected]
- password:
aw3$0m3!
- email:
If I see issues filed where part of the problem is that you copy-n-pasted without reading, I'll close the issue with a link to the wiki.
PLEASE READ THE ENTIRE ARTICLE AND MAKE APPROPRIATE CHANGES, THANK YOU
If you don't have git installed, do so now by issuing sudo apt-get install git
Next, make a copy of the latest version into your home directory
cd ~
git clone https://github.com/mrworf/plexupdate.git
Let's create your config file for plexupdate.sh
nano -w ~/plexupdate.conf
Copy-n-paste the next section (but make necessary changes for your own login and download directory):
USER='[email protected]'
PASS='aw3$0m3!'
DOWNLOADDIR='/home/john/'
AUTOINSTALL=yes
AUTODELETE=yes
AUTOUPDATE=yes
CRON=yes
Hit CTRL-X
and answer yes to save the changes as /home/john/plexupdate.conf
.
To run plexupdate.sh on a schedule, we have to create the cronjob. On ubuntu, this is fairly easy. I'm going to suggest you run the update on a weekly schedule to avoid hammering every day. Feel free to change weekly to any of the other /etc/cron.*
however, avoid /etc/cron.d
, since it's something else.
Anyway, to open a new file as root:
sudo nano -w /etc/cron.weekly/plexupdate
In this file, you write:
#!/bin/sh
/home/john/plexupdate/plexupdate.sh --config /home/john/plexupdate.conf
exit $?
Hit CTRL-X
and answer yes to save the changes. Next, make the file executable:
sudo chmod +x /etc/cron.weekly/plexupdate
The resulting script is run on a weekly basis and by virtue of running via cron, it's ROOT by default, so no need to sudo or otherwise do special tricks. The exit $?
simply passes on the exit code from plexupdate.sh
to cron.
- Do not forget to change username from
john
to whatever you're logging in as - Enter you own plexpass credentials, these are obviously fake :-)
- This works on ubuntu, might need slight tweaks for other distros (feel free to add new sections describing how)
- All paths should be absolute in the configuration file AND in the cron script, or you'll run into issues.