Difference between revisions of "keep ubuntu updated office pc"

From WebHostingNeeds.com
Jump to: navigation, search
m
 
Line 29: Line 29:
 
#!/bin/bash
 
#!/bin/bash
  
/usr/bin/apt-get update && /usr/bin/apt-get upgrade
+
/usr/bin/apt-get update && /usr/bin/apt-get -y upgrade
 
</pre>
 
</pre>
  

Latest revision as of 09:22, 26 September 2014

Since desktop user have no sudo, update via GUI won't work as normal.

What we can do is, set a cronjob for user "root", that will run "apt-get update && apt-get upgrade"


First become user root

sudo -s

Now you are user root, verify with "whoami" or "id" commands.

Create a folder

mkdir /usr/hostonnet

Now create file

vi /usr/hostonnet/update.sh

Add following content

#!/bin/bash

/usr/bin/apt-get update && /usr/bin/apt-get -y upgrade

Make it executable

chmod 755 /usr/hostonnet/update.sh

Set cronjob, lets run it everyday at 1 PM (lunch break ?)

00 13 * * * /usr/hostonnet/update.sh >/dev/null 2>&1

Now everyday at 13:00 hours, PC will update itself. Make sure you are setting cron a user "root".

cat /var/spool/cron/crontabs/root



office