Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to create a simple cron in unix

Posted on 2015-01-05
4
Medium Priority
?
261 Views
Last Modified: 2015-01-05
I need to create a very simple cronjob in unix to be launched at certain time, lets say 22:30, it will need simply to launch a simple script with the command date to be written on a file, just that.


The crons in my system right now are these, in this location:

crontab -l
00 02 * * * $HOME/folder1/script1.ksh >/dev/null
00 15,30,45 * * * * $HOME/folder1/script2.ksh >/dev/null
00 02 * * * $HOME/folder1/script3.ksh > $HOME/menu/log/mylog.log
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
4 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 40532270
30 22 * * * date > /path/to/file

Use "crontab -e" to open the crontab with an editor. Add the above line and save the crontab.

Replace "/path/to/file" with a valid path and name of your choice. Use ">>" instead of ">" to append to the file instead of overwriting it.
0
 
LVL 18

Expert Comment

by:sventhan
ID: 40532300
you need to add this entry on your crontab

by typing at the prompt

crontab -e

then add this...

30 22 * * * /path/to/the/script

path to the script is your executable.
0
 

Author Closing Comment

by:celtician
ID: 40532449
thank you!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

610 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