- 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 01:02 AM
тАО06-10-2009 01:02 AM
run a script every two days ?
I want to run a script every two days,who can give me a good methodя╝Я
Thank you very much!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 01:18 AM
тАО06-10-2009 01:18 AM
Re: run a script every two days ?
you can define a cron job for every day.
In your script you can check a text file, start with '0', if it's '0' start the script and change the value to '1'.
If it's '1' change to '0' and exit your script without running.
HTH
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 01:34 AM
тАО06-10-2009 01:34 AM
Re: run a script every two days ?
This will run your cron every alternate day
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 02:16 AM
тАО06-10-2009 02:16 AM
Re: run a script every two days ?
create cron job,
this link describe which values is possible to use to become your schedule.
http://www.adminschoice.com/docs/crontab.htm
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 02:42 AM
тАО06-10-2009 02:42 AM
Re: run a script every two days ?
you can set in cronjob
In cronjob set weekdays as 1,3,5,7
means if you want to run script name job in every 2 days at 1:00 am then following will be the line you have to edit in cronjobs using crontab -e
00 1 * * 1,3,5,7 /home/job
Regards
Sunny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 03:22 AM
тАО06-10-2009 03:22 AM
Re: run a script every two days ?
As everyone said the simple and best solution is set your job into crontab!!
Total 6 field's are there in crontab file
min hour day month dayofweek command
* * * * * *
Example
# Trim log files 1st. and 16th. Of every month at 11 PM.
0 23 1,16 * * /trimlog
for more info about crontab
see man pages
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 03:25 AM
тАО06-10-2009 03:25 AM
Re: run a script every two days ?
Is that in the "monthday" field or the
"weekday" field? I don't see this notation
in the HP-UX "man crontab" page:
http://docs.hp.com/en/B2355-60130/crontab.1.html
Please help me find it.
> In cronjob set weekdays as 1,3,5,7
You mean "crontab"? In the field described
as:
weekday
The day of the week, 0-6, 0=Sunday
where "7" seems to be conspicuously absent?
How many people believe that there is an
even number of days in a week? (Or a month,
every month? Or a year, every year?)
> [...] who can give me a good method?
Not so many people as you might have thought,
apparently.
> In your script you can check [...]
Probably not as reliable as a cron-only
scheme, but at least it can count. You could
store the day-of-year in the file, too, and
have the script check for any missed days, if
that sort of problem detection would be
useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 03:39 AM
тАО06-10-2009 03:39 AM
Re: run a script every two days ?
You are right steven i think following cron job will help
0 1 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 * * /home/job
Regards
Sunny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 04:00 AM
тАО06-10-2009 04:00 AM
Re: run a script every two days ?
I think Volkmar has the most appropriate solution --- use a file into which you write either a "0" or a "1" every time your script executes. If on startup the file contains "0"; overwrite it with "1" and exit. If on startup the file contains "1" overwrite itwith "0" and continue your execution cycle.
There is no "/' notation in HP-UX's implementation of cron. This is a GNU/Linux offering.
Specifying a series of days in your crontab entry (e.g. 1,3,5 ... 29,31) doesn't work well since months contain a variable number of days (let alone compensating for leap years).
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2009 04:00 AM
тАО06-10-2009 04:00 AM
Re: run a script every two days ?
>Not so many people as you might have thought, apparently.
lol - thanks Steven
@Sunny - this will also not work, after the 31st the 1st follows, so no day between.
V.