- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Cronjob
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:21 PM
04-05-2004 05:21 PM
Cronjob
can anyone help me in setting cron job on HP-UX server.
Thanks in advance.
Regards,
Krishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:30 PM
04-05-2004 05:30 PM
Re: Cronjob
The first are are the minutes of the hour. The second 7-18 which means I want to only run it between the hours of 7AM and 6PM (24 hour clock). The next is the day of the month, the number of the Month and finally the Weekday.
1,16,31,46 7-18 * * 1-5 /techsupp/util/diskspace.sh -e"sysadmin"
The idea of cron is to run the job only. All variables, commands etc are embedded in the script or program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:34 PM
04-05-2004 05:34 PM
Re: Cronjob
$crontab -e
Then add the entry to the crontab file as stated earlier.
30 * * * * /opt/diskmon.sh
30 * * * * fields denote,
minute The minute of the hour, 0-59 hour The hour of the day, 0-23
monthday The day of the month, 1-31
month The month of the year, 1-12
weekday The day of the week, 0-6, 0=Sunday
So above I am running a script every thirty minutes all thru' the year.
check man crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:36 PM
04-05-2004 05:36 PM
Re: Cronjob
thanks for your reply.But I know the syntax of cron,i don't know where to set the cron.can please send me where and how we will send the cron job of my script
Thanks for your help.
Regards,
Hari Krishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:36 PM
04-05-2004 05:36 PM
Re: Cronjob
The steps you need to follow in setting up a cronjob are as follows
1. crontab -e
2. scroll down to the last line and insert
a line
3. Then as per Michael's instructions
submit your script
4. The typical entry on the line that
you inserted will look something like
what Michael has illustrated nicely
1,16,31,46 7-18 * * 1-5 /techsupp/util/diskspace.sh -e"sysadmin"
where diskspace.sh is your script and other descriptions are as mentioned by Micahel in the post prior to this
Let us know if you have any questions
regards
Mobeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:39 PM
04-05-2004 05:39 PM
Re: Cronjob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:42 PM
04-05-2004 05:42 PM
Re: Cronjob
Thanks for your response.
Thanks once again to all
Regards,
Krishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2004 05:42 PM
04-05-2004 05:42 PM
Re: Cronjob
The cron daemon is started during the system boot process and executes time scheduled jobs.
# ps -ef | grep crom # is cron running?
# cron # start the cron daemon, if it isn't currently running
Jobs are submitted to cron with crontab command. Root controls who can use crontab through /var/adm/cron/cron.allow file.
If cron.allow does not exist then /var/adm/cron/cron.deny is checked to determine if the user should be denied access. If both exist, cron.allow takes precedence. If neither file exists, only root is allowed to submit a job.
An empty cron.deny file allows all to use crontab.
Each user that is using the cron daemon should have a cron configuration file in the /var/spool/cron/crontabs directory. The cron daemon consults the files in this directory to determine which jobs should be executed when A % character in the command field (unless escaped by \) is translated as a new-line character.
You must redirect standard output and standard error of your commands. If you don't, any output generated will be mailed to you. Examples:
# min hour date month day command
# 0-59 0-23 1-31 1-12 0-6 be sure to redirect output!
0 * * * * /usr/bin/date >/dev/console
0 6 1,15 * * >/var/adm/btmp
0 5 * * 1-5 /usr/bin/who | /usr/bin/lp
Always use full path names for commands and files names, since cron uses only the standard environment of /usr/bin/sh and doesn't know about your environment.
# crontab -e # edit and submit a cron file
# crontab -l # view your cron file
# crontab -r # remove all your scheduled cron jobs.
By default crontab opens the user's own cron file. However system administrator can modify any user's cron file by command: crontab -e user1
Cron log file /var/adm/cron/log should be checked and emptied regularly. Although the files in /var/spool/cron/crontabs can be viewed with ls and cat, they should never be edited or removed. Doing so can leave the cron daemon in an undefined state.
Always use the crontab command when making changes to scheduled cron jobs.
sks