LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-09-2008, 04:07 PM   #1
d00dness
LQ Newbie
 
Registered: Sep 2008
Posts: 11

Rep: Reputation: 0
How to setup / launch a cronjob antivirus scan


Good day. Reciently I've installed the Symantec Scan Engine 5.1 software on one of my linux servers. The software comes with a command line scanner which you run from a terminal window. I've made a shell script which will do the scan but I can not figure out how to launch a terminal window first and then run the commands within the shell script. Lastly I'd like to include this shell script in a weekly cronjob. Below is the script I came up with. Thanks..


Code:
#!/bin/bash
#antivirus.sh
#20080909 - Scott
#-This script will run the command line antivirus scanner to the internal antivirus server
echo "Starting Scan"
cd /
./ssecls -server <ip> -verbose -mode scan -recurse /lib /home /bin
echo "Scan Complete"
 
Old 09-09-2008, 04:16 PM   #2
arckane
Member
 
Registered: Sep 2005
Location: UK
Distribution: Gentoo/Debian/Ubuntu
Posts: 307

Rep: Reputation: 38
Depending on your distro, but generally as sudo or root do:

crontab -e

Then put in what you want to run:

Code:
# m h  dom mon dow   command
00 02 * * * "apt-get update"
That runs at 2 mins past midnight (or 00:02), calls apt-get update to do it's thang. You would put in the full path to your script.

Why would you want to create a terminal session for a background job anyway? Regardless, if you have aterm installed you can do:

Code:
aterm -e /path/to/command
You might want to check the switch, but I think it's the -e to call an interactive terminal.
 
Old 09-09-2008, 04:24 PM   #3
d00dness
LQ Newbie
 
Registered: Sep 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for the reply..... The reason I want to see the results is because these are development machines and I need to be sure what the end results are displayed as. This way I can determine if the finding is a true virus finding or a false positive. Unfortunately I do not have aterm, just a your normal 'terminal' window which comes with Gnome. Also these are RedHat Linux Enterprise 5.1 machines.
 
Old 09-09-2008, 09:20 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
If you want to see the results, either

1. manually open a xterm and run it
2. as above, but redirect stdout, stderr to a file eg

/path/prog >prog.log 2>&1

OR

nohup /path/prog >prog.log 2>&1 &

to run backgrounded and you can logout without breaking it.

Don't install prog in root dir.
 
Old 09-10-2008, 09:07 AM   #5
d00dness
LQ Newbie
 
Registered: Sep 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for everyones reply..... I found the answer from asking around... here's what the script looks like now...

Code:
#!/bin/bash
#antivirus.sh
#20080909 - Scott
#-This script will run the command line antivirus scanner to the internal antivirus server
exec 1>>scan.log 2>&1
echo "Starting Scan"
cd /
./ssecls -server <ip> -verbose -mode scan -recurse /lib /home /bin
echo "Scan Complete"
No terminal to open for the program to work, the results go to a log file which I can view daily. Thanks to everyone for thier inputs....I apprecaite the help...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to setup antivirus on my linux server cj_cheema Linux - Security 3 01-17-2007 07:46 AM
setup to launch either Gnome or KDE jakubi Fedora 2 02-22-2006 03:17 AM
How to make bitdefender antivirus auto scan incoming mail ginda Linux - Software 1 03-15-2005 11:42 AM
HP PSC 2510xi printer scan setup on Fedora, HELP? KevinAlaska Linux - Hardware 0 05-16-2004 03:42 PM
kaspersky antivirus setup penpun Linux - Security 6 09-27-2002 06:42 AM


All times are GMT -5. The time now is 06:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration