- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: configuring cron job
Operating System - HP-UX
1752297
Members
4364
Online
108786
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
02-15-2006 10:33 PM
02-15-2006 10:33 PM
Re: configuring cron job
Hi Shiv,
My advice would be do like me and write a Header for all your cronfiles with the summarized syntax e.g:
# /sm/cron/cronfile.root
# crontab file for the super-user.
#
# ==========================================================================
# F O R M A T
# ==========================================================================
# Minute Hour Month_Day Month Weekday Command
# (0-59) (0-23) (1-31) (1-12) (0-6)*0=sun run-string
# * = in any crontab field represents all legal values.
# Therefore, to schedule the ps(1) cmd to execute at 5:10pm on every
# friday and monday during june, july, august, you would make an entry
# in your crontab fithe that looks like this :
# 10 17 * 6,7,8 1,5 ps>>psfile 2>&1
# The 2>&1 redirects any error msg to the file psfile.
# ==========================================================================
# archive annuelle de l export le 3 dimanche de janvier chaque annee
#00 04 * 1 0 /sm/bin/archive_annuelle >>/sm/log/archive_ann.er 2>&1
...
You may notice I also put the file in a place where all cronfiles should be (my standards...) with the name of the user of this cronfile. So I rarely (almost never) use crontab -e and can then alway compare the curent and the file for modifications and if there are any ask why (especially roots) I am not informed... some modifications are done by software installation (...)
Dont forget to explicitely redirect ouputs (std and error) otherwise cron will keep on sending you mails about them...
If you do read a .profile to set env variable or do a su -, dont forget to add in that .profile a test for interactive session (since you are in batch mode) e.g.
if [[ $- = *i* ]]; then #tty interactive test (VBE - 030306)
# set term if it's not set
...
fi
otherwise cron will in the messages it will send complain its "not a typewriter"...
Now you should be able to write down a crontab script that is easily readable and exempt of most common errors...
All the best
Victor
My advice would be do like me and write a Header for all your cronfiles with the summarized syntax e.g:
# /sm/cron/cronfile.root
# crontab file for the super-user.
#
# ==========================================================================
# F O R M A T
# ==========================================================================
# Minute Hour Month_Day Month Weekday Command
# (0-59) (0-23) (1-31) (1-12) (0-6)*0=sun run-string
# * = in any crontab field represents all legal values.
# Therefore, to schedule the ps(1) cmd to execute at 5:10pm on every
# friday and monday during june, july, august, you would make an entry
# in your crontab fithe that looks like this :
# 10 17 * 6,7,8 1,5 ps>>psfile 2>&1
# The 2>&1 redirects any error msg to the file psfile.
# ==========================================================================
# archive annuelle de l export le 3 dimanche de janvier chaque annee
#00 04 * 1 0 /sm/bin/archive_annuelle >>/sm/log/archive_ann.er 2>&1
...
You may notice I also put the file in a place where all cronfiles should be (my standards...) with the name of the user of this cronfile. So I rarely (almost never) use crontab -e and can then alway compare the curent and the file for modifications and if there are any ask why (especially roots) I am not informed... some modifications are done by software installation (...)
Dont forget to explicitely redirect ouputs (std and error) otherwise cron will keep on sending you mails about them...
If you do read a .profile to set env variable or do a su -
if [[ $- = *i* ]]; then #tty interactive test (VBE - 030306)
# set term if it's not set
...
fi
otherwise cron will in the messages it will send complain its "not a typewriter"...
Now you should be able to write down a crontab script that is easily readable and exempt of most common errors...
All the best
Victor
- « Previous
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP