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.