?
Solved

Cron Job

Posted on 2002-07-25
6
Medium Priority
?
312 Views
Last Modified: 2010-04-21
How can I write cronjob that executes a command and sends the output to another file.  Then I would like to schedule a job to run at 7:00 everyday.  Where can I find material to learn about cronjobs.
0
Comment
Question by:UnixKid
6 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 7178996
man 5 crontab
0
 
LVL 38

Accepted Solution

by:
yuzh earned 200 total points
ID: 7179077
edit your crontab to add a cron task like the followings:

0 7 * * * /full-path-to/yourcommand > /tmp/outfile 2>&1


eg, if you want to run "find", use /usr/bin/find, and the outfile must be the full path to outfile.

if you are not running it as the super user "root", then you need to ask your sys adm to set up let you run cron job.

do a
man crontab

find out more details


0
 
LVL 1

Expert Comment

by:m4rc
ID: 7203620
i always put this as a comment on the top of my crontab,
as a reminder

#minute hour    mday    month   wday    command

and then add a comment before each entry so its easier to
understand the intention of the entry.

# at 7am every day run yourcommand and save the output to
# outfile
0 7 * * * /full-path-to/yourcommand > /tmp/outfile 2>&1
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 21

Expert Comment

by:tfewster
ID: 7921702
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by yuzh

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7967266
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question