- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cron issue
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
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
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
08-18-2010 09:58 PM
08-18-2010 09:58 PM
cron issue
cat samplecron
0,10,20,30,40,50 * * * * /usr/bin/bdf >> /tmp/bdf.log
i can get the output but my problem is
if i schedule new cron job and i execute crontab filename ,, previous running cron job get removed.
how can i preserve the previous running cron jobs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:04 PM
08-18-2010 10:04 PM
Re: cron issue
Easiest way:
$ crontab -l >oldcron.txt
$ cat oldcron.txt newcron.txt | crontab -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:15 PM
08-18-2010 10:15 PM
Re: cron issue
Your crontab entry must contain ALL of your jobs. If you want to add more, you can use "crontab -e".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:18 PM
08-18-2010 10:18 PM
Re: cron issue
How did you enter new cron jab ?
crontab -e ??
You mean after save the crontab, you cannot see your previous job anymore inside cron with the command:
# crontab -l ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:33 PM
08-18-2010 10:33 PM
Re: cron issue
when i created first cron job i used vi samplecron
then i executed crontab firstcronjob
for adding second cron job for the same user again i used vi editor and i executed
crontab secondcronjob
after that i listed jobs with crontab -l ,, firstcronjob was missing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:43 PM
08-18-2010 10:43 PM
Re: cron issue
That's what Hakki suspected. You can't do that. You must put ALL of your user's crontab entries in one "logical" file. The one you pass to crontab(1).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:44 PM
08-18-2010 10:44 PM
Re: cron issue
Is that anything like a _problem_?
> [...] and i executed
> crontab secondcronjob
man crontab
Not knowing your HP-UX version, I can't quote
the exact text, but I'd guess that it says
something like:
Create or replace your crontab file by
copying the specified file, [...]
Nothing there about "appending the specified
file".
> crontab -e ??
You might consider using that option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:54 PM
08-18-2010 10:54 PM
Re: cron issue
i have to use crontab -e and add the second job.
after that do i need to execute
crontab secondjob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 10:58 PM
08-18-2010 10:58 PM
Re: cron issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 11:25 PM
08-18-2010 11:25 PM
Re: cron issue
No, you keep using "crontab -e". Or you can use "crontab -l" and put that in a file and resubmit that file with your changes.
>can I have an example for particular user having one job already and to add another cron job.
Use "crontab -e" to edit your existing crontab entry. Then add as many as you want.
Note: One problem with "crontab -e" is that you don't have a backup if your disks crash and it isn't in a source management system.
So you could just start with a file and just add to it, then use "crontab file" each time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2010 01:33 AM
08-19-2010 01:33 AM
Re: cron issue
If you want to do it for another user, you have to add the '-u
So:
$ crontab -l -u dummyuser >oldjobs
$ cat oldjobs newjobs | crontab -u dummyuser
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2010 02:46 AM
08-19-2010 02:46 AM
Re: cron issue
# cd /var/spool/cron/crontabs
Save old cron.
# crontab -l > crontab.old
Modify crontab file:
# crontab -e
List crontab file:
# crontab -l
rgs,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2010 08:01 AM
08-20-2010 08:01 AM
Re: cron issue
There is no need to go there unless you want to back up these files.
Also don't edit these files directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2010 04:55 PM
08-22-2010 04:55 PM
Re: cron issue
As a new UNIX user/administrator you need to quickly learn that "man" is your best friend...
man crontab
... will give you the the answer you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2010 10:21 AM
08-24-2010 10:21 AM
Re: cron issue
hi newunix,
If you are creating cron like vi xyz.cron, after adding all jobs to xyz.cron, you have to use below command to activate above crontab.
crontab xyz.cron
If you are adding more cron jobs to xyz.cron edit in vi and then again use crontab xyz.cron to activate.
Thx,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2010 07:25 PM
08-24-2010 07:25 PM
Re: cron issue
!its better to use crontab -e instead of vi
Regards
Mc