12-11-2013
Quote:
Originally Posted by
jim mcnamara
Unless you are running realtime this is normal, expected behavior.
crond runs exactly once a minute. It has to check anyone of dozens of cron entries, then exec anything that needs to start.
If you need something to execute to within nanoseconds of a time frame you will have to:
1. write C code with a realtime clock, like clock_gettime()
http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/clibref/qnx/clock_gettime.html
2. have cron start your C job 1 minute early, make your C job check time constantly then execute the date command as close to the time you need.
You have a bad assumption I think.
You need to understand on a multiprocessing (not realtime) system that the scheduler tries to give all processes a shot at the cpu. That means all of the services you have running, ex.: on the zoned solaris 10 box I am on that is about 140+ processes. Many of them run at high or realtime priority, like zsched. These can preempt a cronjob at any time.
Do not attempt realtime priority on your own unless you are willing to have your code completely lock up the system. I noticed you seem to have root access, so you could do that. Given your question, this is a fair statement.
Ok I understand what you're explaining to me, but in practice I have to compile with gcc and run this source to ejectue anticipates the execution of the script before and at the time more precisely to that process is going to run it?
Which is executed by the sample source code program? as I can modify it to run my script.
thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Where can someone find info on Cron Jobs? Very new to UNIX and the PC I inherited looks to have several of them. Looks like they are some kind of background program that runs automatically at specified times. Would like to delete some of them and know more about them. (6 Replies)
Discussion started by: dereckbc
6 Replies
2. Shell Programming and Scripting
Hi All,
i am trying to automate a process and have to create a unix script like wise. I have a scenario in which i need to automate a file movement. Below are the steps i need to automate.
1. Check whether a file (Not Fixed name-Pattern search of file say 'E*.dat') is present in a... (2 Replies)
Discussion started by: imu
2 Replies
3. UNIX for Advanced & Expert Users
Good Morning.
The problem started after tha migration to a newer version of oracle - migration to oracle 9i. Before the migration jobs that were scheduled in crontabs were running ok. but after the migration they are not running.
I understand that is not easy to find out what the problem is.... (4 Replies)
Discussion started by: alexcol
4 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I have problem in executing a shell script. When the shell script is executed at the shell prompt the script works successfully but when the same script is run as a cron job it fails to execute the files called within the shell script.
I have scheduled the job in my crontab file as
... (6 Replies)
Discussion started by: forumthreads
6 Replies
5. Solaris
Hi SunOS Experts
where will look up to correct the problem with my sunos, it normally shutdown on its own and reboot itself.
i am suspecting that somebody has scheduled it to be doing like that . which file can i look up to correct this problem.this is a server that is suppose to be up 24/7.... (2 Replies)
Discussion started by: dba
2 Replies
6. Red Hat
How to find out jobs scheduled by "at" command? (1 Reply)
Discussion started by: johnveslin
1 Replies
7. Shell Programming and Scripting
I had a cron file named mycron.cron and this file has cron jobs runs through out 365 days (jobs in the file mycron.cron run hourly, daily, weekly, monthly, quarterly and yearly). Is there an easy way to find what are the jobs scheduled today and what time they are scheduled to run?
Thanks in... (1 Reply)
Discussion started by: sureng
1 Replies
8. Solaris
There are two jobs in Solaris , Cron and at jobs..
I know how to disable or enable cron jobs.
How can I enable at jobs and disable it.
Kindly help.
Rj (2 Replies)
Discussion started by: jegaraman
2 Replies
9. Red Hat
I've scheduled few jobs using cron. But they are not running .....
What might be the possible reasons ?? Also tell me how to troubleshoot.............
Please help me .......
Thanks in Advance. (2 Replies)
Discussion started by: vamshigvk475
2 Replies
10. UNIX for Beginners Questions & Answers
Team,
Hope you all are doing fine
I have one admin server which is being used dedicately to run cron jobs on hourly basis, fetching the details from Database which is in a different server.These cronjob are run on every hourly/5 minutes basis depending as per end user requirement.The script... (12 Replies)
Discussion started by: whizkidash
12 Replies
LEARN ABOUT OPENSOLARIS
clock_gettime
clock_settime(3C) Standard C Library Functions clock_settime(3C)
NAME
clock_settime, clock_gettime, clock_getres - high-resolution clock operations
SYNOPSIS
#include <time.h>
int clock_settime(clockid_t clock_id, const struct timespec *tp);
int clock_gettime(clockid_t clock_id, struct timespec *tp);
int clock_getres(clockid_t clock_id, struct timespec *res);
DESCRIPTION
The clock_settime() function sets the specified clock, clock_id, to the value specified by tp. Time values that are between two consecutive
non-negative integer multiples of the resolution of the specified clock are truncated down to the smaller multiple of the resolution.
The clock_gettime() function returns the current value tp for the specified clock, clock_id.
The resolution of any clock can be obtained by calling clock_getres(). Clock resolutions are system-dependent and cannot be set by a
process. If the argument res is not NULL, the resolution of the specified clock is stored in the location pointed to by res. If res is
NULL, the clock resolution is not returned. If the time argument of clock_settime() is not a multiple of res, then the value is truncated
to a multiple of res.
A clock may be systemwide (that is, visible to all processes) or per-process (measuring time that is meaningful only within a process).
A clock_id of CLOCK_REALTIME is defined in <time.h>. This clock represents the realtime clock for the system. For this clock, the values
returned by clock_gettime() and specified by clock_settime() represent the amount of time (in seconds and nanoseconds) since the Epoch.
Additional clocks may also be supported. The interpretation of time values for these clocks is unspecified.
A clock_id of CLOCK_HIGHRES represents the non-adjustable, high-resolution clock for the system. For this clock, the value returned by
clock_gettime(3C) represents the amount of time (in seconds and nanoseconds) since some arbitrary time in the past; it is not correlated in
any way to the time of day, and thus is not subject to resetting or drifting by way of adjtime(2), ntp_adjtime(2), settimeofday(3C), or
clock_settime(). The time source for this clock is the same as that for gethrtime(3C).
Additional clocks may also be supported. The interpretation of time values for these clocks is unspecified.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The clock_settime(), clock_gettime() and clock_getres() functions will fail if:
EINVAL The clock_id argument does not specify a known clock.
ENOSYS The functions clock_settime(), clock_gettime(), and clock_getres() are not supported by this implementation.
The clock_settime() function will fail if:
EINVAL The tp argument to clock_settime() is outside the range for the given clock ID; or the tp argument specified a nanosecond value
less than zero or greater than or equal to 1000 million.
The clock_settime() function may fail if:
EPERM The requesting process does not have the appropriate privilege to set the specified clock.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-------------------------------------+
|ATTRIBUTE TYPE |ATTRIBUTE VALUE |
+-----------------------------+-------------------------------------+
|Interface Stability |Committed |
+-----------------------------+-------------------------------------+
|MT-Level |clock_gettime() is Async-Signal-Safe |
+-----------------------------+-------------------------------------+
|Standard |See standards(5). |
+-----------------------------+-------------------------------------+
SEE ALSO
time(2), ctime(3C), gethrtime(3C), time.h(3HEAD), timer_gettime(3C), attributes(5), standards(5)
SunOS 5.11 5 Feb 2008 clock_settime(3C)