473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Setting up an alarm scheduler?

I have procedure that I would like to run in perl that checks a data feed that I have running. I wrote the code to checks if the feed is up, now I would like to create an alarm that will use this code and check the feed every minute. Nothing should happen if it is up, otherwise it will send me an email.

I'm just a new to perl, could someone help me in setting up this alarm to run my code say every minute.

Thanks
Apr 8 '08 #1
5 1505
KevinADC
4,059 Expert 2GB
You could use the sleep() function to make your script wait for one minute:

sleep(60)

besides that your question is confusing because you say you want an alarm but to me it seems like you do not need an alarm, you just need to slepp() then check the data feed and take appropriate action depending on the status of the feed.

if you really want an alram use the alarm() function.
Apr 8 '08 #2
ok

I guess I sleep would work too.

I've been having trouble getting them to do what I want.

could you give me an example with sleep and alarm that just prints hello world every 5 seconds?

thanks
Apr 8 '08 #3
KevinADC
4,059 Expert 2GB
This will never stop running, you will have to manually terminate it with kill or something else:

Expand|Select|Wrap|Line Numbers
  1. while (1) {
  2.     $|++; # flush the buffers - might not be necessary
  3.     print "Hello World\n";
  4.     sleep(5);
  5.     next;
  6. }
I don't think you would not use an alarm for this type of looping.
Apr 8 '08 #4
Thanks, that is what I am looking for. I want this to always be running. This is one of those time where an infinite loop can be of use. My thinking on alarm was every minute when the alarm goes off I would run my sub, sleep should work the same.

Thanks
Apr 8 '08 #5
KevinADC
4,059 Expert 2GB
hehehe... glad you understood my tortured statement:

I don't think you would not use an alarm for this type of looping.
of course I meant that you "would not use an alarm".
Apr 8 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: keepyourstupidspam | last post by:
Anyone know of a reliable design for a Windows C++ Task Scheduler Class. The scheduler will expose a member function that will add schedules, its parameters will be an interval to run the tasks...
1
by: Sergey | last post by:
How to send alarm to a thread? I can set alarm in main thread, but how then send exception to another thread to wake it if it executes too long?
7
by: Adrian Casey | last post by:
I have a multi-threaded python application which uses pexpect to connect to multiple systems concurrently. Each thread within my application is a connection to a remote system. The problem is...
1
by: nkechifesie | last post by:
I have written a program that handles licences stored in the Access Database via Visual Basic front end. I need to program an alarm that would alert the user where the program is installed that a...
0
by: puntino | last post by:
Hi I have developed an Alarm, I haven' problem of runtime or compiletime but the application seems blocked. When I call the method AlarmExecute, it runs only the first time ( when i click onto run...
0
by: thelightkeeper | last post by:
Hi, in MSSQL, I have 2 tables naming , --------------------------------------- EquipmentID : nvarchar(50), FK, reference .EquipmentID AlarmID : nvarchar(50), PK AlarmHappenTime :...
8
by: hambones | last post by:
Heya, I can't seem to find any references to a way that I can set the system alarm clock. I am using a Motorola Q which is running Windows Mobile 5.0 Smartphone. I am not sure if the best...
2
by: Alan Isaac | last post by:
Goal: turn off an audible alarm without terminating the program. For example, suppose a console program is running:: while True: sys.stdout.write('\a') sys.stdout.flush() time.sleep(0.5) ...
8
by: superleochen | last post by:
Database is simliar to this: ID TIME TAGNAME VALUE 5967383 8/1/2008 1:00:24 AM I16MUDL11 ALARM 5967384 8/1/2008...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.