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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
11-16-2003, 02:33 PM
|
#1
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Rep:
|
CRON Jobs
Hello,
I am running a SMB server that I use for centralized file storage as well as a software storage center so that my clients can easily access the software storage center and download software that they see fit.
My question is this, I would like to set a cron job to automatically download daily updates to an anti-virus software and possibly push those updates down to the clients. I know it is possible to do the first thing, but the second, I'm not sure about.
Someone have any ideas? Thank you.
|
|
|
|
11-16-2003, 02:42 PM
|
#2
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Hi Scott,
and yes, the Cron job download is a piece of cake :)
The other thing (pushing the files) is quite straightforward,
too, if the clients happen to be linux machines. You could
set-up a password-less ssh connection for a particular
user (like antivir) and then simply
scp new_signatures antivir@<target_host>:/<apth>/<to>/<sig>
Cheers,
Tink
|
|
|
|
11-16-2003, 02:50 PM
|
#3
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
Hi Tink,
Thanks for the help. Now since I know it's possible, let me go into specifics. The clients are Windows clients (hence my use of smb).
I use Norton Anti-Virus on the Windows machines and I would like to automatically retrieve the daily Intelligent updater definitions. I get those from this site:
http://securityresponse.symantec.com...es/US-N95.html
I download those into a directory called:
/software/Norton Definitions
Now, as you may or may not know, those updates are daily. Can you tell me what I need to do to set up my linux server to retrieve those updates?
The second batch of instructions you gave me are a little harder for me to understand. I've only been working with Linux for less than a year and I'm still learning quite a bit, however, my time is limited now due to my work schedule. Thanks.
|
|
|
|
11-16-2003, 03:05 PM
|
#4
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Hummmm :)
I'd go with using a bash-script ...
first, download the pages html code from the site
using wget, then filter the page for .exe and .zip
and use wget again to retrieve them.
As for the distribution bits ... I'm not sure about
ssh clients for windows, and interaction with
linux' ssh passwordless authentication, and
as for the time being am not going to read up
on it. :} But you could write a little windows.cmd
file, store that on the samba server, and use
windows' scheduled task feature to run it.
Cheers,
Tink
|
|
|
|
11-16-2003, 03:21 PM
|
#5
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
Very interesting,
I knew that there would be a way to do this. . . . However, not to sound stupid, but I've never used WGET before. Can you help me with this?
Secondly, you mention filtering out for the .exe and .zip files. Umm, I need some help with this. As I said, I've not been using Linux for more than about 8 months so your patience would be appreciated. Thanks.
|
|
|
|
11-16-2003, 04:21 PM
|
#6
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
I haven't tested it since I don't need the
files, but it should work :} Have a play with it.
This will dowload all EXE's and ZIP's from that
page .... hope this is what you needed?
Cheers,
Tink
|
|
|
|
11-16-2003, 05:13 PM
|
#7
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
Yep, that is what I wanted. Thanks a lot!! With that script, at what times will it run or how would I set it to run at a specific time? Tell me, did you write that script out yourself? I've only had one Unix class and our shell scripting segment didn't get nearly that complex. I'm kind of a total novice when it comes to writing shell scripts.
Secondly, and I don't know if you can help with this, but you mentioned setting a scheduled task on the windows machine to run it, however, with that I would have to click on the dialog boxes that appear when the Intelligent Updater is run.
Thirdly, what directory would that script have to be located and what should I name the file in order to run?
And Fourth, I wish the files to be downloaded to a specific directory, where would I specify the directory to save the files to?
Last edited by scottpioso; 11-16-2003 at 05:18 PM.
|
|
|
|
11-16-2003, 07:24 PM
|
#8
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally posted by scottpioso
Yep, that is what I wanted. Thanks a lot!! With that script, at what times will it run or how would I set it to run at a specific time?
|
You'll have to set-up a cron job for that.
This script is just what's meant to run at a
given time that you have to choose yet.
Quote:
|
Tell me, did you write that script out yourself? I've only had one Unix class and our shell scripting segment didn't get nearly that complex. I'm kind of a total novice when it comes to writing shell scripts.
|
The script is simple, so is the call to awk :}
Quote:
|
Secondly, and I don't know if you can help with this, but you mentioned setting a scheduled task on the windows machine to run it, however, with that I would have to click on the dialog boxes that appear when the Intelligent Updater is run.
|
Ummm ... maybe we should move that part
to the General forum mate, this has NOTHING
to do with Linux anymore ;)
Quote:
|
Thirdly, what directory would that script have to be located and what should I name the file in order to run?
|
Whatever you wan to call it. And put it where ever
you feel like. For cron to be able to run it you'll have
to specific the full path to it, anyway.
You'll have to
chmod u+x <filename>
to be able to run it.
But if you're doing nifty things like this you
really should read up on what you're doing ;)
Quote:
|
And Fourth, I wish the files to be downloaded to a specific directory, where would I specify the directory to save the files to?
|
If you had a specific directory in mind you'd
probably want to put a
cd /<your>/<specific>/<directory>
as the second line of that script.
Cheers,
Tink
|
|
|
|
11-17-2003, 02:57 PM
|
#9
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
Hi Tink,
You said the second line of this script? So you mean after bin/bash or after wget?
#!/bin/bash
wget http://securityresponse.symantec.co...ges/US-N95.html
for getIt in `awk -F'"' '/=.+\.(zip|exe)\>/ {print $2}' US-N95.html`
do
wget http://securityresponse.symantec.com/$getIt
done
Also, let's say I want this script to run at 1700 (5PM) every day. Where would I put that in?
And you made a comment about reading up on what I''m doing, where would you suggest doing that? I've only been running LInux for less than a year so that's why my questions probably seem simple to you.
Last edited by scottpioso; 11-17-2003 at 03:02 PM.
|
|
|
|
11-17-2003, 03:27 PM
|
#10
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Hi Scott!
Quote:
Originally posted by scottpioso
You said the second line of this script? So you mean after bin/bash or after wget?
|
After the sha-bang line :)
add a
cd /<your>/<target>/<directory>
Quote:
|
Also, let's say I want this script to run at 1700 (5PM) every day. Where would I put that in?
|
crontab -e
add a line
00 17 * * * /path/to.your/script 2>&1 > /var/log/antivir
Quote:
|
And you made a comment about reading up on what I''m doing, where would you suggest doing that? I've only been running LInux for less than a year so that's why my questions probably seem simple to you.
|
Heh ... the questions sound simple, the answers
take some time ;) ...
http://www.icon.co.za/~psheer/book/ is a pretty good
introduction, and there's always the man pages...
man man for help on how to use them...
If you have questions about cron, for instance,
try a
man -k cron
(alternatively, apropos cron)
Cheers,
Tink
|
|
|
|
11-17-2003, 03:51 PM
|
#11
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
I'm sorry, I know you're kidding about the sha-bang line, but I guess I'm a litle slow on the uptake, what did you mean by that?
|
|
|
|
11-17-2003, 04:01 PM
|
#12
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally posted by scottpioso
I'm sorry, I know you're kidding about the sha-bang line, but I guess I'm a litle slow on the uptake, what did you mean by that?
|
# = hash = sha
! = bang
No worries :) ... this is being used in the
advanced bash howto (I think?) ...
So, #!/bin/bash = the sha-bang line
Cheers,
Tink
|
|
|
|
11-18-2003, 07:56 AM
|
#13
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
Hi Tink,
One more question for you if you would be so kind. I was wondering, since my scripting experience is very limited, if you could break down that script and tell me exactly what each command does? I'm just really curious.
Secondly, my shell scripting experience, as you can tell, is very limited and I was wondering how I could get better at doing it? Are there books like dummies books that start from the beginning, give good practice excercises, and advance? I was just curious.
Anyway, I think later today I will get started on this little project. Thanks again!
|
|
|
|
11-18-2003, 12:20 PM
|
#14
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally posted by scottpioso
Hi Tink,
One more question for you if you would be so kind. I was wondering, since my scripting experience is very limited, if you could break down that script and tell me exactly what each command does? I'm just really curious.
|
Sure, even though the script is far from complex.
Code:
#!/bin/bash <- Tells the shell what "language" to expect, bash-script in this case
wget http://securityresponse.symantec.co...ges/US-N95.html <- wget, download URL to current directory
for getIt in `awk -F'"' '/=.+\.(zip|exe)\>/ {print $2}' US-N95.html` <- awk, a powerful editor, it looks through the downloaded file, searches for lines that contain a string that begins with a "=" and ends in either ".exe" or ".zip", and returns the 2nd field in this line; -F sets the field delimiter (' ' by default, '"' in our case; look at the html file with an ASCII editor and you'll know why). The matching lines (6 at the time I downloaded) are handed over to the shells built in list-feature by including the whole awk-thing in "`". Now the shell will run the loop that's defined by do/done for each occurence awk found,
do <- that is, it will wget six files (their name each time in the variable $getIt); since the strings we found were relative addresses we just prepend them with the symantec website, concatenating the string
wget http://securityresponse.symantec.com/$getIt
done <- end of loop
Quote:
Secondly, my shell scripting experience, as you can tell, is very limited and I was wondering how I could get better at doing it? Are there books like dummies books that start from the beginning, give good practice excercises, and advance? I was just curious.
Anyway, I think later today I will get started on this little project. Thanks again!
|
Curious is a VERY good start, really :}
Look at this - either download or read online.
http://www.tldp.org/guides.html#abs
Also there are "Shell-programming for dummies" books
out there.
A highly recommendable book as a desktop-reference
is O'Reiley's "Linux in a nutshell".
Cheers,
Tink
|
|
|
|
11-18-2003, 03:24 PM
|
#15
|
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 460
Original Poster
Rep:
|
Tink,
I really appreciate all of your help. I thought I was going to be able to get started on this today, but like so many of my days lately, I haven't been able to. See, I work nights and my days are spent mostly in bed and now I'm just getting up and I don't think now is the time to really get started on this project. I guess I'll wait until the weekend. Oh well. . . Hey, if you're ever in the area, look me up. Where are you from anyway? I'd have to guess by your use of language that you're from Austrailia?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Cron Jobs
|
XaViaR |
Linux - General |
1 |
06-23-2005 06:57 PM |
|
Cron Jobs with MySQL
|
SharkBait |
Mandriva |
1 |
06-07-2005 01:23 AM |
|
cron jobs
|
working2hard |
Linux - Software |
0 |
07-28-2004 05:31 PM |
|
cron jobs
|
Zyanid |
Linux - Software |
0 |
08-27-2002 05:10 AM |
|
creating cron jobs
|
jonfa |
Linux - General |
5 |
05-26-2002 05:05 PM |
All times are GMT -5. The time now is 06:01 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|