- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Comments in Crontab
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
Discussions
Forums
Forums
Discussions
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
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-29-2002 07:26 AM
тАО04-29-2002 07:26 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:31 AM
тАО04-29-2002 07:31 AM
Re: Comments in Crontab
# will comment the command . It will read it as a comment line and not a command line.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:31 AM
тАО04-29-2002 07:31 AM
Re: Comments in Crontab
HP do not support comments in the crontab file.
make a copy of the file then edit the original to remove the non required entries.
John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:33 AM
тАО04-29-2002 07:33 AM
Re: Comments in Crontab
and when you want to put the lines back simply copy the backed up file over the crontab file being used.
John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:34 AM
тАО04-29-2002 07:34 AM
Re: Comments in Crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:34 AM
тАО04-29-2002 07:34 AM
Re: Comments in Crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:36 AM
тАО04-29-2002 07:36 AM
Re: Comments in Crontab
YES!
I have been doing it for years.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:39 AM
тАО04-29-2002 07:39 AM
Re: Comments in Crontab
man crontab says:
<
Blank lines and those whose first non-blank character is # will be ignored.
<
It works fine to use comments in your crontab. Blank lines also.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:44 AM
тАО04-29-2002 07:44 AM
Re: Comments in Crontab
Please donot be confused , all of us run this stuff . and it works , it is a standard ASCII file and if you see a template which looks like this
#ident "@(#)root 1.14 97/03/31 SMI" /* SVr4.0 1.1.3.1 */
#
# The root crontab should be used to perform accounting data collection.
#
# The rtc command is run to adjust the real time clock if and when
# daylight savings time changes.
#
10 3 * * 0,4 /etc/cron.d/logchecker
10 3 * * 0 /usr/lib/newsyslog
15 3 * * 0 /usr/lib/fs/nfs/nfsfind
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
01 0 * * 4 /root/backups/arbdat01_backup.sh
20 4 * * * . /etc/env.BDDM; /opt/BDDM/bin/traceCleanup > /dev/null 2>&1 #BDDM
05 3 * * * . /etc/env.BDDM; /opt/BDDM/bin/DMbackup > /dev/null 2>&1 #BDDM
35 0,12 * * * . /etc/env.BDDM; /opt/BDDM/bin/logchecker > /dev/null 2>&1 #BDDM
at the start you will see lines which are commented , that doesnot mena that the same are ecuted.
All the best.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:44 AM
тАО04-29-2002 07:44 AM
Re: Comments in Crontab
I should have said YES because it does work but I have been led to believe by HP that the supported method to do as you wish is using several crontab files rather than comments to stop jobs running.
so YES it does work and its not supported
cheers
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:52 AM
тАО04-29-2002 07:52 AM
Re: Comments in Crontab
One thing to keep in mind is that the crontab file(s) are only read when cron starts up.
So you should edit with the crontab -e command, crontab ~/your_cron_file OR edit the file manually and kill -HUP the cron PID. All methods will "force" a reread of the crontab files.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 07:57 AM
тАО04-29-2002 07:57 AM
Re: Comments in Crontab
SIGHUP cron? I have never had to do that in the past.
just crontab -e
Works for me everytime.
-Yates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 08:06 AM
тАО04-29-2002 08:06 AM
Re: Comments in Crontab
If one *manually* edits w/o using crontab -e , for example using vi, then one would have to kill -HUP the cron PID.
I agree that crontab -e is the easiest....but you also run the risk of saving a corrupt/typo'd file inadvertently.
The recommended method is to create the file in one's home dir & use the crontab ~/my_cron_file command to let it place it & restart the cron daemon. This also gives one the opportunity to have *several* cron files - precisely what this user is looking for.
But I also use crontab -e frequently.......
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 08:15 AM
тАО04-29-2002 08:15 AM
Re: Comments in Crontab
You are correct, for the method you stated.
I hope I didn't sound to defensive.
Peace,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2002 08:19 AM
тАО04-29-2002 08:19 AM
Re: Comments in Crontab
No...not at all.
No offense taken, nor proffered
Have a great day,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 04:40 AM
тАО04-30-2002 04:40 AM
Re: Comments in Crontab
Don't know if you are convinced yet, but everytime that we have a holiday I suspend my backups using crontab -e and comment out the backup command with a # sign. I then remove the # sign with crontab -e when I want the backup to be reactivated.
I have never had a problem.
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 11:35 AM
тАО04-30-2002 11:35 AM
Re: Comments in Crontab
Hi!
Cronfile Example
####
0 8 * * 1,2,4,5 /lnULOGGLOBO.sh 2>&1
0 10 * * 0,3,6 /lnULOGGLOBO.sh 2>&1
#15 * * * * /moncpu.sh > /moncpu.log 2>&1
####
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 01:09 PM
тАО04-30-2002 01:09 PM
Re: Comments in Crontab
Here's a little something an
admin should kep in mind, esp if you are changing crontabs for users other than root. If you edit the crontab directly, vi /usr/spool/cron/crontabs/<> then you must recycle the cron daemon for it to "see" the modified crontab. Most systems /etc/inittab launch cron with the "respawn" option, so it is OK to kill the cron pid.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 03:20 PM
тАО04-30-2002 03:20 PM
Re: Comments in Crontab
cron simply doesn't care what you put in your crontab file as comments. As far as managing crontab files, there are as many methids as there are sysadmins. My method is to always keep root's 'official' crontab file in root's $HOME, specifically in the .cronfiles directory. That way, if a newbie sysadmin blows away the crontab entry, it can easily be restored. You make the changes to the $HOME/.cronfiles/crontab.root file, then simply replace the current crontab entry with:
crontab $HOME/.cronfiles/crontab.root
No restart of cron, no crontab -e, etc. I find that with multiple root admins, this works the best. And the .cronfiles directory keeps the crontab reference a bit hidden.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2002 11:34 PM
тАО04-30-2002 11:34 PM
Re: Comments in Crontab
OK I have messed up real bad but its been interesting to see all the feed back i was told recommended not unsupported. I shall endevour to improve my english grammer, as well as my memory.
John.