Solved

How to use Cron command

Posted on 1997-12-01
5
240 Views
Last Modified: 2013-12-26
I have to automate the execution of a program into
my server and I would like to know how to use
the Cron command in order to do this from a web site
directory (I have I vortual server hosted on a Sun
station working with OS Sun solaris 2.5
0
Comment
Question by:italnet
  • 2
  • 2
5 Comments
 

Author Comment

by:italnet
ID: 1295705
Edited text of question
0
 

Accepted Solution

by:
xilef earned 20 total points
ID: 1295706
Use the command "crontab -e" to edit your cronfile (the file which contains the commands to execute at given times). The cronfile then consists of as many lines as you want with the following format:
m h dm m dw command
Where
 m = minute
 h = hour
 dm = day of the month
 m = month
 dw = day of the week
 command = the command you want to execute
Now, replace the characters above with values when you want your command to be executed. If you want to execute something every hour, write:
0 * * * * /path/to/my/command
If you want to execute something every 15 minutes, write:
0,15,30,45 * * * * mycommand

For more information, see the man page of the crontab-command.

0
 
LVL 2

Expert Comment

by:gormenghast
ID: 1295707
Hi...

Before you use crontab -e you may want to set your default editor to whatever you want to use...for example:

# EDITOR=vi
# export EDITOR

Also dont put any blank lines in the crontab file ## comments are ok.


0
 

Author Comment

by:italnet
ID: 1295708
Hi,
Crontab does not respond to my query.
I followed all directions both  from you and
from other infos I found online....No results.
Where the mistake is?
1) I created following file txt
    0,15,30,45 * * * * /to/my/dir/file
2) [telnet] crontab filename.txt   (OK)
3) [telnet] crontab -l  (OK I listed the file)
4) [telnet] crontab run (and I receive an e-mail
    which inform on job execution but....
    he was unable to locate .cfg file
    (it is the config file of the program which
     I want to be execute. This is a strange story
     as this config file is in the same dir of  the
     program file and when I run it directly
     on telnet all works fine!)
Do you have suggestions?

0
 

Expert Comment

by:xilef
ID: 1295709
You should probably first "cd" to this directory. Make a small script which contains "cd /path/to/your/progrm/; ./program".

This way, everything should work.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 85
Folder Comparison 12 54
Whole sheet autoscrub still needed 19 50
ASCII Non-Printable characters/codes and their HTML equivalents 6 113
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

10 Experts available now in Live!

Get 1:1 Help Now