LinuxQuestions.org
Visit Jeremy's Blog.
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, 03: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, 03:16 PM   #2
arckane
Member
 
Registered: Sep 2005
Location: UK
Distribution: Gentoo/Debian/Ubuntu
Posts: 308

Rep: Reputation: 39
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, 03: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, 08:20 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,349

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
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, 08: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 06:46 AM
setup to launch either Gnome or KDE jakubi Fedora 2 02-22-2006 02:17 AM
How to make bitdefender antivirus auto scan incoming mail ginda Linux - Software 1 03-15-2005 10:42 AM
HP PSC 2510xi printer scan setup on Fedora, HELP? KevinAlaska Linux - Hardware 0 05-16-2004 02:42 PM
kaspersky antivirus setup penpun Linux - Security 6 09-27-2002 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:39 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
Open Source Consulting | Domain Registration