- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: run a script every two days ?
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
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
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-10-2009 04:42 AM
тАО06-10-2009 04:42 AM
Re: run a script every two days ?
if you don't like to read in a file, you also can check if a file exists.
So for example start with file 'file0.txt', if this file exists move it to 'file1.txt' and run your script. If it doesn't exist mv the file 'file1.txt' to 'file0.txt' and do nothing more.
(you also could write the current date to this file for 'problem detection' ...)
HTH
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 04:42 AM
тАО06-10-2009 04:42 AM
Re: run a script every two days ?
Well, at least it doesn't fail _every_ week.
> [...] who can give me a good method?
I suppose that only a few failures every year
might be "good", for some values of "good".
Sigh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 06:50 AM
тАО06-10-2009 06:50 AM
Re: run a script every two days ?
Depending on how accurately you care about "every" two days, you can simply check on the julian day of the year.
if (( $(date +%j) % 2 == 0 )); then
exit
fi
If you need to be accurate for the next decade or so, you can get the previous year and test for a multiple of 4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 04:33 PM
тАО06-10-2009 04:33 PM
Re: run a script every two days ?
I think V. Nyga's method is a better way and Steven Schweda is a responsible man~
I will add the script then.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 07:07 PM
тАО06-10-2009 07:07 PM
Re: run a script every two days ?
Slight variation. If the file exists, remove it and exit.
If it doesn't, touch it and continue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 09:46 PM
тАО06-10-2009 09:46 PM
Re: run a script every two days ?
> remove it and exit.
> If it doesn't, touch it and continue.
As usual, many things are possible.
Of course, if a come-and-go file is
accidentally deleted, then you can't detect
its absence as a problem. Other schemes are
harder to fool. Everything's complicated.
(Or else it should be.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 10:33 PM
тАО06-10-2009 10:33 PM
Re: run a script every two days ?
This is failsafe. It then does it the next day. So it is a feature. :-)
I'm assuming that "every two" is fuzzy and we aren't printing duplicate checks. ;-)
- « Previous
-
- 1
- 2
- Next »