- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- crontab entry help
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
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
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-20-2012 12:40 PM
04-20-2012 12:40 PM
crontab entry help
Hi,
i want to disable the script every 1st and 3rd starturday. please help how make a crontab entry.
30 5 * * * /home/app.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2012 04:26 PM
04-20-2012 04:26 PM
Re: crontab entry help
>i want to disable the script every 1st and 3rd Saturday. please help how make a crontab entry.
You can not. You must put these checks into the script, since cron only ORs specs like that.
Add this near the top of your script:
# Check 2 & 3 Sat
set -A dates $(date +"%e %w")
#echo "Day, weekday: ${dates[0]}:${dates[1]}"
if (( ${dates[1]} == 6 && ${dates[0]} >= 8 && ${dates[0]} <= 21 )); then
echo "Skipping second and third Saturdays"
exit 0
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2012 12:09 AM
04-21-2012 12:09 AM
Re: crontab entry help
Hi,
- As per 1st & 3rd saturday to skip , per Dennis's script : you can use like below, in your script at the begining:
-Nothing can be done in the crontab entries.
Add this near the top of your script:
-----------
# Check 1st & 3rd Satday to skip.
set -A dates $(date +"%e %w")
#echo "Day, weekday: ${dates[0]}:${dates[1]}"
# For 1st Saturday.
if (( ${dates[1]} == 6 && ${dates[0]} >= 1 && ${dates[0]} <=7 )); then
echo "Skipping First Saturdays"
exit 0
fi
# For 3rd Saturday:
if (( ${dates[1]} == 6 && ${dates[0]} >= 15 && ${dates[0]} <=21 )); then
echo "Skipping Third Saturdays"
exit 0
fi
# End 1st/3rd satday skip check function.
-------------
Hth,
Raj D.