?
Solved

Cron Job

Posted on 2002-07-25
6
Medium Priority
?
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 84

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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

650 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