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 HPUX
clock_gettime
clocks(2) System Calls Manual clocks(2)
NAME
clock_settime(), clock_gettime(), clock_getres() - clock operations
SYNOPSIS
DESCRIPTION
clock_settime()
The function sets the specified clock, to the value specified by Time values that are between two consecutive non-negative integer multi-
ples of the resolution of the specified clock are truncated down to the smaller multiple of the resolution.
clock_gettime()
The function returns the current value for the specified clock,
clock_getres()
The resolution of any clock can be obtained by calling Clock resolutions are implementation defined and are not settable by a process. If
the argument is not NULL, the resolution of the specified clock is stored into the location pointed to by If is NULL, the clock resolution
is not returned.
A clock may be system wide, that is, visible to all processes; or per-process, measuring time that is meaningful only within a process.
The following clocks are supported:
This clock represents the realtime clock for the system.
For this clock, the values returned by and specified by represent the amount of time (in seconds and nanoseconds) since
the Epoch. It is a system wide clock. The privilege is required to set this clock. Processes owned by the superuser
have this privilege. Processes owned by other users may have this privilege, depending on system configuration. See
privileges(5) for more information about privileged access on systems that support fine-grained privileges.
This clock represents the amount of time (in seconds and nanoseconds)
that the calling process has spent executing code in the user's context. It is a per-process clock. It cannot be set
by the user.
This clock represents the amount of time (in seconds and nanoseconds)
that the calling process has spent executing code in both the user's context and in the operating system on behalf of
the calling process. It is a per-process clock. It cannot be set by the user.
These clocks are high resolution hardware clocks
present on HP-RT realtime systems. It is included here so that applications accessing this hardware can be compiled on
HP-UX systems and then ported to an HP-RT target. HP-UX does not support or
RETURN VALUE
A return of zero indicates that the call succeeded. A return value of -1 indicates that an error occurred, and is set to indicate the
error.
ERRORS
If any of the following conditions occur, the and functions return -1 and set (see errno(2)) to the corresponding value:
The functions
and are not supported by this implementation.
The argument does not specify a known clock.
The argument to is outside the range for the given
The argument specified a nanosecond value less than zero or greater than or equal to 1000 million.
The requesting process does not have the necessary privileges to set the
specified clock.
The or argument points to an invalid address.
EXAMPLES
Advance the system wide realtime clock approximately one hour:
Get the resolution of the user profiling clock:
AUTHOR
and were derived from the proposed IEEE POSIX P1003.4 Standard, Draft 14.
SEE ALSO
timers(2), privileges(5).
STANDARDS CONFORMANCE
clocks(2)