cron ? automating a script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cron ? automating a script
# 1  
Old 12-19-2007
cron ? automating a script

Hi all.
basically i need to run a script every 30 minutes.
my script is simply an error report:

errpt

thats it, is there anyway to make this happen every 30 minutes
without having to type errpt in, the script will get bigger as i add more things to do but just need to know how to automate it.
Also dont know anything about cron
thanks guys.
# 2  
Old 12-19-2007
Seek and ye shall find.

Search for crontab here on this forum.
# 3  
Old 12-19-2007
Here is a cron entry that would probably work:
Code:
0,30 * * * * /mydir/errpt

However, there are some gotchas:
1. You may not have permission to run cron jobs, so cron.allow would need your account name adding. (And easy way to check is to issue the command "crontab -e" and see if it errors or works.)
2. Your script may not work depending upon the scripting language you've used and OS you're running on (ie. Solaris comes with only Bourne shell support in cron).
3. Your script may assume environment variables that work when you run it interactively, but aren't there when it's run via cron.
4. Your OS (bloomin' Solaris again!) may be configured to only allow a limited number of concurrent cron jobs, so other schedules may impact yours.

Have fun!

Last edited by prowla; 12-19-2007 at 05:27 PM.. Reason: amendment
# 4  
Old 12-19-2007
Quote:
Originally Posted by prowla
2. Your script may not work depending upon the scripting language you've used and OS you're running on (ie. Solaris comes with only Bourne shell support in cron).
I've just checked on Solaris 9 on SPARC, it happily runs cron jobs using sh, ksh or csh. Not sure what you were implying.
# 5  
Old 12-19-2007
Quote:
Originally Posted by porter
I've just checked on Solaris 9 on SPARC, it happily runs cron jobs using sh, ksh or csh. Not sure what you were implying.
I'm pretty this refers to the use of logic in the command in the crontab, or at least that is the only place I can see it making any difference. The job itself is executable or it is not, the interpreter makes no difference.
# 6  
Old 12-19-2007
Quote:
Originally Posted by reborg
The job itself is executable or it is not, the interpreter makes no difference.
... or the interpretor depended on shared libraries found on LD_LIBRARY_PATH that was not set up.
# 7  
Old 12-19-2007
true; I limiting myself to the crontab but yes that is a possibility also.

Then again everybody know that CRON will only give an environment consisting of
HOME
LOGNAME
PATH guaranteed only to find all of the standard utilities.
SHELL

and code accordning don't they SmilieSmilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Automating Linux Script

1. The problem statement, all variables and given/known data: I want to automate the creation or processing of the following: Directory and subdirectory creation for your scenario company Files in each of the directories Symbolic links from 2 subdirectories to their parent directories... (16 Replies)
Discussion started by: ekglag2
16 Replies

2. Shell Programming and Scripting

Automating Linux Script

I want to automate the creation or processing of the following: Directory and subdirectory creation for your scenario company Files in each of the directories Symbolic links from 2 subdirectories to their parent directories Setting appropriate file permissions for the directories and... (1 Reply)
Discussion started by: ekglag2
1 Replies

3. Shell Programming and Scripting

Automating Crontab through script??

is it possible to automate crontab through script... I ll be getting the data i.e. cron entries from DB. (5 Replies)
Discussion started by: nikhil jain
5 Replies

4. Shell Programming and Scripting

automating a perl script

Hi, I have a perl script that takes in 2 numerical values as ARGV. perl script.pl parameter1 num1 num2 in my case I have 1000's of num1 and num2. I can have them in separate files. Please let me know how to automate this run using shell scripting or using awk, so that I don't have to... (4 Replies)
Discussion started by: Lucky Ali
4 Replies

5. Shell Programming and Scripting

Help with automating a bash script

Hi Guys, There are some emails going deferred as we got some new IP's from our ISP. So I was trying to manually copy the deferred mail and forward it to our sales team so that they can contact our client. I am new to this script thing, but luckily I was able to write the code to extract the data... (1 Reply)
Discussion started by: linuxrulz
1 Replies

6. UNIX for Dummies Questions & Answers

Problem automating sFTP transfer using script in cron

Hi Newbie here I am having problems with automating sFTP transfers. Just to save time - SCP is not an option as sFTP is stipulated by controllers of far end server. Ineed to automate sFTP transfer of a single file, once a day to a remote server to which i have no control over. I am using:... (6 Replies)
Discussion started by: robbien
6 Replies

7. Shell Programming and Scripting

Automating A Perl Script over a database

Dear Scripting Gods I've never done shell scripting before and have only recently got to grips with Perl, so apologies for my naivity. I've written a perl program which takes in two files as arguments (these are text documents which take in the information I need) The perl program spits out a... (1 Reply)
Discussion started by: fraizerangus
1 Replies

8. Shell Programming and Scripting

Automating Interactive script

I have a script that will install software on all remote host. At the end of the script it starts the install.sh part and goes into a interactive mode asking Yes or No questions and prompting to add a username and password. My question is how can I script this so that these questions are... (7 Replies)
Discussion started by: soupbone38
7 Replies

9. Shell Programming and Scripting

Help in automating dates in ksh script

I need to run a command at the end of a backup job and this command will produce a report of what my backup jobs have collected in the previous day. The real problem is that this binary works with absolute dates only, so I should have to modify the script every single time I need it to work. It... (1 Reply)
Discussion started by: italia1971luca
1 Replies

10. Shell Programming and Scripting

automating sftp script

I have to write an automated sftp script which uses password authentication method to access the remote server. I want to pass the password as a parameter or to be included in the script itself, so that when i run the sftp script, it should not prompt me to enter the password. Thanks in advance... (1 Reply)
Discussion started by: Rajeshsu
1 Replies
Login or Register to Ask a Question