LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 11-24-2003, 05:04 PM   #31
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30

So you want a program that just downloads the exe and zip files?
If you want just that, put that in cron, with an added -P option that works like this

-P <directory wget should download to>

Just add it to the current wget arguments This would be the program that cron runs. It's just wget, with a lot of arguments.

What exactely do you want?
 
Old 11-24-2003, 05:56 PM   #32
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally posted by teval
You can do this much much simpler...
Make wget filter out what files it downloads.
info wget will give you that..
info wget Following\ Links Types\ Of\ Files
Heh ... I should be downloading more, thanks
for bringing that up :}


Cheers,
Tink
 
Old 11-24-2003, 06:25 PM   #33
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hi Teval,

What exactly do I want? Well, I want to automatically schedule a job to download the Intelligent Updater updates at a specfic time every day into a directory called /software/nortondefs. I would like this to run at 1800 hours local time Mondays through Fridays (as Norton doesn't write updates on weekends). I also wish to push these updates down to the Windows clients for which this is for in the first place but that's another issue that I will address later in a different forum.

With all respect, if you had read my first postings, you would have seen what I was trying to do. So, in this regard can you help me to simplify this task? My scripting experience is very, very limited and I'm quite new to Linux as well, so this is why I kind of need you to take baby steps with me. After I do more and more, it gets easier but for now, your patience is appreciated. Thanks

Last edited by scottpioso; 11-24-2003 at 06:26 PM.
 
Old 11-24-2003, 09:35 PM   #34
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
No problemo

That wget script with the -P option will handle the downloading.
As for upshing to the windows clients, you can do that over Samba, but I've never had to interoperate with Windows, so I have no clue how to. Look up Samba on the web, take the command you find, and the wget command, put them in a script, and off you go.
 
Old 11-25-2003, 08:50 AM   #35
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hi Teval,

I'm confused though, you say to just dump the script into cron. I'm not clear about what you mean exactly. Thanksl

Last edited by scottpioso; 11-25-2003 at 08:53 AM.
 
Old 11-25-2003, 10:39 AM   #36
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
I thought that you only wanted to get the files so I was suggesting you put the wget straight into cron.
For more then 1 command you should use a script, or &&'s.
&& is also good because it checks return values, and if an error occurs aborts everything. An sh script is better though
 
Old 11-25-2003, 02:46 PM   #37
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Okay thanks then Teval,

So I guess I need to go back to what Tink was suggesting. So, can you help me to accomplish what I was doing? And secondly, your use of language is not clear for me to understand. i.e. "For more then 1 command you should use a script, or &&'s.". As I said before, my scripting experience is very limited, so baby steps, buddy, baby steps. Thanks.
 
Old 11-25-2003, 02:56 PM   #38
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
The double & means to the shell that in
"command1 && command2"
command2 will only be executed if command1
was successful. It is, so to speak, chaining two
commands, and it's not a shell scripting thing,
you can do that on the command-line as well....

e.g. if you ran
make menuconfig
to configure your kernel, you can then continue
with
Code:
make dep && make bzImage && make modules && make modules_install

Cheers,
Tink
 
Old 11-25-2003, 02:59 PM   #39
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hmm, okay thanks Tink,

Well, I will continue this project on the weekend. This is a holiday weekend for us so I have Wednesday and Thursday night off.
 
Old 11-26-2003, 10:38 AM   #40
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hi ya Tink,

Well, I'm home for a couple of days and as mentioned before, I'm getting an error when I run the script and it's also downloading the entire page instead of just the zips and exe files. This is the error. . . Could you tell me what's wrong?

[root@ASUSA7V266-E scott]# ./norton.sh
--09:30:30-- http://securityresponse.symantec.com...es/US-N95.html
=> `US-N95.html'
Resolving securityresponse.symantec.com... done.
Connecting to securityresponse.symantec.com[64.124.201.150]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13,224 [text/html]

100%[====================================>] 13,224 113.28K/s ETA 00:00

09:30:30 (113.28 KB/s) - `US-N95.html' saved [13224/13224]

./norton.sh: line 24: unexpected EOF while looking for matching `"'
./norton.sh: line 30: syntax error: unexpected end of file

Here are lines 23 and 24:

wget http://securityresponse.symantec.com...es/US-N95.html
for getIt in 'awk -F'"' '/=.+\.(zip|exe)\>/ {print $2}' US-N95.html'

and there isn't a line 30. The last line is at 29.


Here is the script as it is in its entirety:

# Anti-virus daily virus definition updates (Intelligent Updater)
# to be downloaded
# automatically to a linux server for distribution to clients running a
# graphical user interface from another well known GUI OS manufacturer.
# This script is freely distributable and the author claims no copyright
# or any other proprietary hold on it.
# You may freely modify or adjust this script as you see fit

#!/bin/bash
# This statement is the default directory that you should create on your
# Linux system. You may change this if you see fit.

cd /software/NortonDefs

# This next statement automatically will call the system to download the files
# necessary from the Norton.com website.

wget http://securityresponse.symantec.com...es/US-N95.html
for getIt in 'awk -F'"' '/=.+\.(zip|exe)\>/ {print $2}' US-N95.html'
do
wget http://securityresponse.symantec.com/$getIt

done




Can you help me out here? Thanks, bud.

Last edited by scottpioso; 11-26-2003 at 12:22 PM.
 
Old 11-26-2003, 12:34 PM   #41
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Ah ha!!! I have the script functioning, Tink. However, it's downloading more than what I really need, so I'll have to play with it.
 
Old 11-26-2003, 03:40 PM   #42
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hello yall,

Well, I've done it whoooohoooooo!!!! I spent about 5 hours on it today and here it is in its final version. . . .

--------------------------------------------------------------------------------------------------
# Norton Anti-Virus Intelligent Updater Download Script
#
# To run this script, change to the directory where it is located and type
# ./norton.sh to launch the program
#
# The following is a Shell Script to automate downloading of Norton anti-virus
# virus Definitions via the Intelligent Updater for storage on a Linux server
#
# This shell script was written by Scott Pioso, with the help of Tinkster to
# allow Linux network administrators to automate the downloading of Norton
# Anti-virus daily virus definition updates (Intelligent Updater)
# to be downloaded automatically to a linux server for distribution to clients
# running a graphical user interface from another well known GUI OS
# manufacturer.

# This script is freely distributable and the author claims no copyright
# or any other proprietary hold on it, You may freely modify or adjust this
# script as you see fit

#!/bin/bash

# The next statement is the default directory that your Linux system will use
# to store the files downloaded. The directory should be created prior to
# running this program. You may change this directory to something else if you
# desire, however, if you do so you must match that directory to the one listed
# below

cd /software/NortonDefs

# This next statement automatically will call the system to download the files
# necessary from the Norton.com website. This step will download all files from
# the page with an .exe file extension

wget http://securityresponse.symantec.com...es/US-N95.html

for getIt in `awk -F'"' '/=.+\.(exe)\>/ {print $2}' US-N95.html`

do

wget http://securityresponse.symantec.com/$getIt

done

# Finally, the last step is to remove the extraneous files that the author did
# not want to save

rm *.html*
rm *i32-1*
rm *x86*

# Now, if you look in the directory created (NortonDefs) you will see one file
# listed. Should you wish to automate this process and push these files down to
# your MS Windows clients, it will be necessary to create a CRON job to do this

# Questions may be directed to the author, Scott Pioso at scottpioso@yahoo.com
# Thank you and long live Linux!!!!
 
Old 11-26-2003, 04:42 PM   #43
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Scott, you could have just used Teval's wget
line and stuck that into your script, and could have
given the for loop a miss ...

I still don't understand why it's getting the entire site,
though. Did you try to find out in which step that
happens? Is it in the original (1st use of wget) or
while you're wgetting from the loop?



Cheers,
Tink
 
Old 11-26-2003, 05:02 PM   #44
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hi Tink,

The problem I was having was related to the quote symbol problems I had before. I was using the wrong quotes and once I figured that out, everything fell together nicely.
 
Old 11-27-2003, 11:02 AM   #45
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Hi ya Tinkster,

One last question related to this topic. . . You mentioned going into the crontab file to fully automate this. This is my crontab file as it is. Where do you suggest putting in my job to run?
---------------------------------------------------------------------------------------------------
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
 
  


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
Cron Jobs XaViaR Linux - General 1 06-23-2005 07:57 PM
Cron Jobs with MySQL SharkBait Mandriva 1 06-07-2005 02:23 AM
cron jobs working2hard Linux - Software 0 07-28-2004 06:31 PM
cron jobs Zyanid Linux - Software 0 08-27-2002 06:10 AM
creating cron jobs jonfa Linux - General 5 05-26-2002 06:05 PM


All times are GMT -5. The time now is 07:30 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration