HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting question
Operating System - HP-UX
1832655
Members
3156
Online
110043
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
10-18-2000 10:26 PM
10-18-2000 10:26 PM
Hi,
Is it possible to have a timer control in a script within a while true loop to stop it from execution. Cron job will use to start the script.
If so, how should be the syntax like.
i.e.
while (08:00 < time < 19:00)
do
...
sleep 5
done
Thanks in advance,
YC
Is it possible to have a timer control in a script within a while true loop to stop it from execution. Cron job will use to start the script.
If so, how should be the syntax like.
i.e.
while (08:00 < time < 19:00)
do
...
sleep 5
done
Thanks in advance,
YC
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2000 10:30 PM
10-18-2000 10:30 PM
Re: Scripting question
Hi,
You can do it, but it is not as simple as your code.
By using the date command with format specifiers, you can easily retrieve the hour and minutes.
HOUR=$(date +"%H")
if [[ ${HOUR} -lt 15 && ${HOUR} -gt 8 ]]
then
# do whatever it is you want to do between 8 and 15
else
# do something else
fi
Hope this helps,
Rik.
You can do it, but it is not as simple as your code.
By using the date command with format specifiers, you can easily retrieve the hour and minutes.
HOUR=$(date +"%H")
if [[ ${HOUR} -lt 15 && ${HOUR} -gt 8 ]]
then
# do whatever it is you want to do between 8 and 15
else
# do something else
fi
Hope this helps,
Rik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2000 10:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2000 09:34 PM
10-19-2000 09:34 PM
Re: Scripting question
Hi,
Just before your loop, you could spawn a child process consisting of a single sleep
followed with a line like the following
kill -USR1 $PPID.
If your parent program traps the USR1 signal,
it can keep on running as long as the
kill isn't issued by the child and then
do whatever is needed, for example exit from
a loop.
Regards,
Dan
Just before your loop, you could spawn a child process consisting of a single sleep
followed with a line like the following
kill -USR1 $PPID.
If your parent program traps the USR1 signal,
it can keep on running as long as the
kill isn't issued by the child and then
do whatever is needed, for example exit from
a loop.
Regards,
Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP