?
Solved

Setting task in crontab to be execuded everyday

Posted on 2015-02-08
2
Medium Priority
?
113 Views
Last Modified: 2015-03-05
I need to get executed myscript.ksh everyday at 7:05 a.m.

How can i say that in my crontab??
0
Comment
Question by:celtician
[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
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 40597116
User crontab:

5 7 * * * /path/to/myscript.ksh >/path/to/myscript.log 2>/path/to/myscript.err

System crontab (/etc/crontab):

5 7 * * * username  /path/to/myscript.ksh >/path/to/myscript.log 2>/path/to/myscript.err

The first field defines the minute (0-59 or *) , the second defines the hour (0-23 or *).
The asterisks mean "every possible value", where the third field defines the day of month (1-31 or *), the next one defines the month (1-12 or * ) and the fifth one defines the day of week (0-6 or 1-7 or *; 0 or 7 mean "Sunday").
The sixth field is in the system crontab the name of the user under whose credentials the script should run, in the user crontab it's the name of the command/script (which is the seventh field in the system crontab).

Instead of ">/path/to/myscript.log 2>/myscript.err" you can discard all possible output with ">/dev/null 2>&1".
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40597283
If you run into errors while cron is executing your myscript.ksh - check the script if it needs any path settings. When you run myscript.ksh interactively in your environment it will probably run just fine. You may need to set a path in your script or put every command in there with a full path so it runs from cron as well.
0

Featured Post

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!

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…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

762 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