- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scheduling the cron jobs with the use of operands
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
06-27-2011 10:52 PM
06-27-2011 10:52 PM
Need to schedule the cronjob, like i am having 2 scipts on my crontab. if 1st job completed successfully then the 2nd job need to start. Is there any operands can we use for that. Please let me know if any options are there.
Thanks!
Simhan
Solved! Go to Solution.
- Tags:
- crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:24 PM
06-27-2011 11:24 PM
Re: scheduling the cron jobs with the use of operands
You only have the first script in your crontab. If successful, the first script can start the next.
Or have three scripts. The new one starts the first and if successful, starts the next.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:26 PM
06-27-2011 11:26 PM
Re: scheduling the cron jobs with the use of operands
Hi,
create a script f.e. cronscript.sh
/path/to/first/script && /path/to/second/script
add the following line to your crontab (Change times)
* * * * * /path/to/cronscript.sh
Or you can enter that line directly into the crontab, using && will only execute the second command if the return code of the first one was zero.
hth
Stephan
How to find the right forum --> New forum location by ITRC tree
"we wouldn't call it code, if we could read it ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:37 PM
06-27-2011 11:37 PM
Re: scheduling the cron jobs with the use of operands
Hello Stephen,
If i want to scedule the ignite backup once the tape drive is rewinded
0 5 11 6 /usr/sbin/mt -t /dev/rmt/omn rewind && * * * * /usr/sbin/make_tape_recovery -A -i -v inc_entire=/dev/vg00 /dv/rmt/0mn
Is that right.. Please correct me if i am wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:46 PM
06-27-2011 11:46 PM
Re: scheduling the cron jobs with the use of operands
>If I want to schedule the ignite backup once the tape drive is rewound
In this case you shouldn't have separate commands in crontab. Instead create one script that does the rewind, waits, then does the ignite.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:47 PM
06-27-2011 11:47 PM
Re: scheduling the cron jobs with the use of operands
@simma100 wrote:Hello Stephen,
If I want to schedule the ignite backup once the tape drive is rewinded
0 5 11 6 /usr/sbin/mt -t /dev/rmt/omn rewind && * * * * /usr/sbin/make_tape_recovery -A -I -v inc_entire=/dev/vg00 /dv/rmt/0mn
Is that right.. Please correct me if I am wrong.
Hi again,
0 5 11 6 /usr/sbin/mt -t /dev/rmt/omn rewind && /usr/sbin/make_tape_recovery -A -I -v
This should work, or as mentioned before create separate scripts for it.
Best,
Stephan
How to find the right forum --> New forum location by ITRC tree
"we wouldn't call it code, if we could read it ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:56 PM
06-27-2011 11:56 PM
Re: scheduling the cron jobs with the use of operands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:57 PM
06-27-2011 11:57 PM
SolutionUps,
sorry of course you should add it - seems i did not copy all, to finalize
0 5 11 6 /usr/sbin/mt -t /dev/rmt/omn rewind && /usr/sbin/make_tape_recovery -A -I -v inc_entire=/dev/vg00 /dv/rmt/0mn
Best,
Stephan
How to find the right forum --> New forum location by ITRC tree
"we wouldn't call it code, if we could read it ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:59 PM
06-27-2011 11:59 PM
Re: scheduling the cron jobs with the use of operands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 05:03 AM - edited 06-28-2011 05:05 AM
06-28-2011 05:03 AM - edited 06-28-2011 05:05 AM
Re: scheduling the cron jobs with the use of operands
Actually, there are a lot of problems with just a rewind and trying to run the backup with a one-liner. Here are the things that need to be checked before you start the Ignite backup:
- Is the device file really a tape?
- Is there a tape inserted in the drive?
- Is the tape write-protected?
- Is the tape busy with another program?
Now the make_tape_recovery program can be run. Additionally, the steps above and the MTR command should be logged in case of a problem and ideally, an email sent to the system administrators. I have attached a script that accomplishes all of these tests and writes the results into the file /var/adm/mtr.log. You can store the file in /usr/contrib/bin/mtr and schedule it in cron like this:
1 1 * * 0 /usr/contrib/bin/mtr /dev/rmt/0mn admins@mycompany.com
That above will run the backup every Sunday at 1:01am.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 07:14 AM
06-28-2011 07:14 AM
Re: scheduling the cron jobs with the use of operands
Is it me or is the attachment missing?
Thanks,
Stephan
How to find the right forum --> New forum location by ITRC tree
"we wouldn't call it code, if we could read it ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 10:38 AM
06-28-2011 10:38 AM
Re: scheduling the cron jobs with the use of operands
Attachments don't seem to be working...the post is rejected without comment when I add an attachment.
Here is a link where you can download the file:
ftp://ftp.sourcedirect.com/contrib/mtr
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 11:22 AM - edited 06-28-2011 11:24 AM
06-28-2011 11:22 AM - edited 06-28-2011 11:24 AM
Re: scheduling the cron jobs with the use of operands
Actually after some testing - it looks like only picture extensions are allowed to attach.
I will open a thread in the Feedback area about it.
Thanks,
Stephan
How to find the right forum --> New forum location by ITRC tree
"we wouldn't call it code, if we could read it ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2011 07:44 AM
06-29-2011 07:44 AM
Re: scheduling the cron jobs with the use of operands
The best way to make a two script process have step two wait for step 1 to be done is to control it with a single script.
script.ksh
!#/usr/bin/ksh
echo "Steve was here"
rc=$?
if [ $rc -eq 0 ]
then
echo "Ready to run second process"
# insert second script name here, full path
else
echo "First step failed. Do not pass go, do not collect $200"
fi
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2011 06:56 PM
06-29-2011 06:56 PM
Re: scheduling the cron jobs with the use of operands
It turns out that only PC-safe files are allowed as attachments...that is, abc.txt is OK but abc is not. The Lithium engine 'adds' the extension .wht to a no-extension filename. So my mtr script is presented here as mtr.txt. Feel free to rename it to a more Unix-like filename.
(finding posted to the Community feedback page)
Bill Hassell, sysadmin