- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- crontab setting
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
04-07-2003 12:02 PM
04-07-2003 12:02 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 12:12 PM
04-07-2003 12:12 PM
SolutionHere is one way to do it at 10:00am on the first and third Fridays of the month with two crontab entries:
0 10 1-7 * 5 /opt/mydir/somejob
0 10 15-21 * 5 /opt/mydir/somejob
If you need your job to run every other Friday, and not just twice a month, I would suggest using 'at'. You could put a line at the end of your script that does something like this:
echo "/opt/mydir/somejob" | at now +2 weeks
Run the job on Friday, and at the end it would reschedule itself to run again in two weeks.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 12:41 PM
04-07-2003 12:41 PM
Re: crontab setting
02 6 * * 5 rm /tmp/usercount.Z
At 6: 02 a.m. every friday remove the file called /tmp/usercount.Z
SEP
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
04-07-2003 12:42 PM
04-07-2003 12:42 PM
Re: crontab setting
cd /home/my
if [ -f junk ]
then
# echo "doing nothing"
rm junk
else
/home/my/filetorun
echo "i just ran" > junk
fi
You may have to tinker with it a bit depending upon which shell you run but it ought to work.
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 12:57 PM
04-07-2003 12:57 PM
Re: crontab setting
John how does this "at" command work? Does it reset the crontab?
Thanks all!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2003 01:12 PM
04-07-2003 01:12 PM
Re: crontab setting
JP
P.S. I'm not actually a king. I'm just the court jester. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2003 12:46 AM
04-08-2003 12:46 AM
Re: crontab setting
another possibility is to schedule the job to run every Friday in crontab, e.g.:
10 15 * * 5 /usr/local/bin/friday.sh
In the nearest future in April 2003 it would cause the script to run on the 11th, the 18th, and the 25th, and May 2.
The script itself can then check which Friday it is, based on the day number of the year, e.g.
Example made April 8, 2003:
# date %+j
098
The immediate Fridays in 2003:
April 11, will be day number 101
April 18, will be day number 108
April 25, will be day number 115
The pattern: odd-even-odd-even etc.
The script can then decide to exit on an even or an odd Friday, example:
#!/usr/bin/sh
#
# Check the day number of the year
#
typeset -i DAY_NUM=$( date +%j )
HALF=$(( $DAY_NUM \/ 2 ))
DOUBLE=$(( $HALF \* 2 ))
if [ "$DAY_NUM" != "$DOUBLE" ]
then
echo odd day
exit
else
echo even day
# exit
fi
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2003 08:32 AM
04-08-2003 08:32 AM