Highland Linux User Group

Linux Community
It is currently Mon Feb 06, 2012 8:28 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Cron Update
PostPosted: Wed Feb 17, 2010 11:16 pm 
Offline
Moderator
User avatar

Joined: Tue Oct 03, 2006 12:27 pm
Posts: 162
Location: Inverness UK
The most important thing is keep your server up to date.
i set my server to update itself every week

create a file in /etc/cron.weekly/
name it whatever you want(ex: apt_backup.sh)


then add this code in:
Code:
#!/bin/sh
apt-get update && apt-get upgrade -y


change permission for it to be excecutable:

#chmod r+x /etc/cron.weekly/apt_backup.sh

and you're done, you can move this file to /etc/cron.daily/, /etc/cron.monthly/ directory to update daily or monthly to suit your need
to be sure it's running you can log it by adding to the end of the file this line:

Code:
echo "Weekly update Successful: $(date)" >> /home/folder/to/log/apt.log

the file should looks like this

Code:
#!/bin/sh
apt-get update && apt-get upgrade -y
echo "Weekly update Successful: $(date)" >> /home/folder/to/log/apt.log


you can add this in crontab instead of adding to directory
type:
#crontab -e
to add cron:

example:

Quote:
00 23 08 * * apt-get update && apt-get upgrade -y


This means the cron will run on every sunday at 23:00pm

to have daily backup

Quote:
00 23 * * * apt-get update && apt-get upgrade -y



This means the cron will run on everyday at 23:00pm

to have Monthly Backup




Quote:
00 23 * 01 * apt-get update && apt-get upgrade -y


This means the cron will run on the first of every month at 23:00pm


to find out more about Cron you can google it or checking this forum out i'll post on here later.

_________________
Computers are like air conditioners, They stop working properly when you open Windows!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2010 Highlands Linux Users Group