LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-06-2006, 08:45 PM   #1
carlito11973
LQ Newbie
 
Registered: Sep 2006
Location: Pittsboro
Distribution: Mandriva Linux 2008.1 official
Posts: 9

Rep: Reputation: 0
Questions about shell scripting and cron jobs


I am new to this forum, I've been using Mandrake 10.1 Official for over a year now, for over 7 months exclusively (finally did away with windoze!), and just recently I've decided to try and learn a few new things with linux. I've been trying to work out a way to set my modem to dial up at a certain time every night, download updates to my anti-virus (which is f-prot), run my anti-virus, and then run chkrootkit. I've written an insanely simple shell script which looks like this:

#/bin/bash
#update

wvdial &

cd /usr/local/f-prot/tools
perl check-updates.pl &

chkrootkit &

cd /usr/local/f-prot
./f-prot / -silent -report=/home/carl/virusscan

exit

I then used vim to edit my root crontab to run this script at 2 a.m. Basically what happens is it runs wvdial, connects to the internet, and that's it. I tried to take the wvdial command out, put it in the crontab first, then run the modified shell script, again all it runs is wvdial. Also, if I just connect to the internet myself, then run the shell script, it runs chkrootkit first, then f-prot, then starts running the check-updates. To be sure I'm using the wrong syntax or forgetting to add something, but like I said, I'm just recently learning how to use this. Any ideas or suggestions? Any would be most appreciated.
 
Old 10-06-2006, 10:13 PM   #2
zhangmaike
Member
 
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
You obviously need these commands to be run in a specific order (connect to internet, THEN check for virus signature updates, THEN run virus scanner), yet you use "&" on virtually every line, which will cause those commands to be run in the background. This is probably not what you want, so remove the &'s:

Code:
#!/bin/bash
#update

wvdial

cd /usr/local/f-prot/tools
perl check-updates.pl

chkrootkit

cd /usr/local/f-prot
./f-prot / -silent -report=/home/carl/virusscan
 
Old 10-06-2006, 10:34 PM   #3
carlito11973
LQ Newbie
 
Registered: Sep 2006
Location: Pittsboro
Distribution: Mandriva Linux 2008.1 official
Posts: 9

Original Poster
Rep: Reputation: 0
Ok, I'll give that a try, let you know how it worked. Thanks!
 
  


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
Shell Scripting Questions blaoulis Programming 5 07-12-2006 07:21 PM
Questions corcerning Cron jobs steve_2010 Solaris / OpenSolaris 2 02-03-2004 08:53 AM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 06:45 PM
Two Linux shell scripting questions thepryme Programming 5 10-23-2003 07:01 AM
cron jobs Zyanid Linux - Software 0 08-27-2002 05:10 AM


All times are GMT -5. The time now is 10:15 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration