Solved

How to create a simple cron in unix

Posted on 2015-01-05
4
233 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
4 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delete a folder ever 5 minutes 6 60
Path of Workbook 3 59
Problem to event 3 75
Need a version of telnet and/or ssh that supports tcp wrappers on AIX 5.1 16 68
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…
Utilizing an array to gracefully append to a list of EmailAddresses
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

930 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now