run script in crontab

Posted on 2007-08-08
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

    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

    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

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    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…
    FreeBSD on EC2 FreeBSD ( 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 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…
    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.

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now