Automatic Update Script?
#1
Hi, Just installed last week Ubuntu 8.04 Server for the first time and having lots of fun with XBMC. I'm trying to find the best method to get my box to automatically download the daily SVN PPA. Ideally I would like to have a script that would run every morning around 3am, kill the xbmc task, do an apt-get install xbmc, then reboot when done. From what I have been reading the crontab command is what I need to accomplish this but having some trouble getting started. Any help would be appreciated. Thanks!
Reply
#2
Why do you want to reboot? Anyway, this is untested, but something like this should do it.

Save as ~/scripts/updatexbmc.sh and chmod +x, then add to root's crontab as

0 3 * * * /home/youruser/scripts/updatexbmc.sh >/dev/null 2>&1

If you don't want to run as root, you'll need to setup sudoers to run the stuff without a password and use sudo before each line except the kill command.

Code:
#!/bin/bash
#kill xbmc
ps aux|grep -i youruser|grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill -9
# update/upgrade packages
apt-get update
apt-get upgrade
#reboot machine
reboot

Ought to work.
Reply
#3
Hrm, won't this update and upgrade ALL Ubuntu packages? XBMC will have to be set to run automatically when the machine boots as well. I agree that the reboot is probably not necessary and in my case would cause no end of issues - my video doesn't come up correctly if my EDID data cannot be read from my display. That data can only be read if the panel is on and is an active source for my Linux box. I could tweak around this but it would be painful I think.

Anyway, rebooting without access to a systems monitor that might be off for the night or in use with another source might have poor results when the machine comes up. I'd simply cycle XBMC rather than the whole system and I'd be careful about updating\upgrading all packages <shrug>
Openelec Gotham, MCE remote(s), Intel i3 NUC, DVDs fed from unRAID cataloged by DVD Profiler. HD-DVD encoded with Handbrake to x.264. Yamaha receiver(s)
Reply
#4
Since our PPA isn't an official Ubuntu repo I'm fairly certain you have to manually install the packages.
Reply
#5
Code:
apt-get upgrade -y --force-yes

That will allow you to auto-upgrade from a script.
Reply
#6
If you add the PPA to your sources.list, apt-get upgrade should do it. And yeah, use blubya's -y switch, forgot about that.

I don't know why he wanted to reboot either. Shrug.
Reply
#7
rodalpho Wrote:I don't know why he wanted to reboot either. Shrug.

Windows user Wink
Reply
#8
Using something like this
apt-get upgrade xbmc -y --force-yes

should limit it to only updating xbmc
Reply
#9
althekiller Wrote:Windows user Wink

Lol you got me... Thanks for the suggestions guys!
Reply

Logout Mark Read Team Forum Stats Members Help
Automatic Update Script?0