Posted: . At: 9:05 AM. This was 3 years ago. Post ID: 15484
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



Installation of Anti Virus software for Linux.


  1. Installation of Anti Virus software for Linux. This is to protect Windows users who are connecting to the Linux server. Also a very useful backup script for our Linux machine
  2. Linux backup script
  3. Using the script

Installation of Anti Virus software for Linux. This is to protect Windows users who are connecting to the Linux server. Also a very useful backup script for our Linux machine

This document describes the installation and configuration of an Anti Virus product for Linux. I have chosen the Clamav Anti Virus product for x86 Linux

This Anti-Virus product is installed on a Debian based system with this command.

homer@neo:~$ sudo apt-get install clamav clamav-base

This will install the Clamav product and enable the virus protection service on the Linux computer. This is very useful for protecting users of the Linux file server from any infected files that were put there by employees. This software will run automatically in the background and scan files to prevent infection of Windows clients that are accessing the Linux file server.

Linux backup script

backup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl -W
use strict;
use POSIX ("strftime");
# A script to backup some files.
my $homedir = "$ENV{'HOME'}";
my $user = $ENV{'LOGNAME'};
my $date = strftime("%A-%d-%B-%Y-%H-%M-%S", localtime);
my $backupdrive = "/mnt/MyMedia";
print "Which directory do you want to backup?n";
#chomp(my $dir = <STDIN>);
$dir = "/opt/tafeshare";
if(!$dir) {
	print "No Directory selected!n";
	exit;
} else {
	my $target="$homedir/$dir";
	my $file = "$homedir/$user-$date.tgz";
	system("tar -cvf $file $target");
	print "nnSuccessful backup of directory: $dir.n";
# Naming the outfile.
	my $outfile="$user-$date.tgz";
# Moving the backup file to the destination.
	print "Moving the archive $outfile to the backup drive.n";
	system("mv $outfile $backupdrive");
 
# Checking to see if the backup file exists.
 
	my	$filename = "$backupdrive/$outfile";
	if (-e $filename) {
		print "nnBackup file exists. Great Success!nn";
	}
	exit;
}

Using the script

This script may be used by entering this into the cron jobs. This is done by typing crontab -e and entering this line.

30 17 * * * "/root/backup.sh"

This will run the script every day at 17:30. The archives may easily be extracted and files recovered from each backup if this is required. Each backup image is date stamped, this makes finding the archive for a certain date simple. This is the perfect solution for backing up all user files at the end of the day.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.