Learn how to a build a cloud-first strategyRegister Now


run script in crontab

Posted on 2007-08-08
Medium Priority
Last Modified: 2013-12-06
Dear EE members,
I would like to perform a shell script in cronjob for every one hour. But I am new to HP-UX cronjob. Any example on how to do it in safeway while accurate and effective.

Thank you.

Question by:peter_chong

Author Comment

ID: 19660475
Dear EE members,
My crontab not running:
I type crontab -e
* * * * * date >/dev/null 2>&1

I expected it run date command every minute.
But nothing happened at all.
Do you know why?


LVL 16

Accepted Solution

Hanno P.S. earned 600 total points
ID: 19668431
Did you think about the command's output?
Where does it go?

When a job is being run by 'cron' it is not attached to a terminal -- therefore, it cannot output to screen!

You will have to redirect the output to a file -- any output sent do stdout and stderr will be mailed to the crontab owner.

To have a job bein run once every hour (zwenty minutes after the hour) use
20 * * * *   /path/to/my/script >/path/to/my/script.log 2>&1

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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
Course of the Month20 days, 21 hours left to enroll

810 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