Sponsored Content
Operating Systems Linux Fedora Accuracy of jobs scheduled in cron Post 302879211 by jim mcnamara on Wednesday 11th of December 2013 09:38:24 AM
Old 12-11-2013
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/...k_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.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cron Jobs

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

Conditional File Movement script scheduled using CRON job

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

Jobs scheduled in crontabs are not running after a migration to oracle 9i

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

problem when the script is scheduled to run as cron job

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

where to check scheduled jobs in SunOS

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?

How to find out jobs scheduled by "at" command? (1 Reply)
Discussion started by: johnveslin
1 Replies

7. Shell Programming and Scripting

List all daily scheduled cron jobs from my cronfile

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

Cron jobs and at jobs

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

Cron Jobs not running at scheduled time

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

Cron job scheduled is running once, but reports are generating twice

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
RTPRIO(2)						      BSD System Calls Manual							 RTPRIO(2)

NAME
rtprio, rtprio_thread -- examine or modify realtime or idle priority LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <sys/rtprio.h> int rtprio(int function, pid_t pid, struct rtprio *rtp); int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); DESCRIPTION
The rtprio() system call is used to lookup or change the realtime or idle priority of a process, or the calling thread. The rtprio_thread() system call is used to lookup or change the realtime or idle priority of a thread. The function argument specifies the operation to be performed. RTP_LOOKUP to lookup the current priority, and RTP_SET to set the priority. For the rtprio() system call, the pid argument specifies the process to operate on, 0 for the calling thread. When pid is non-zero, the sys- tem call reports the highest priority in the process, or sets all threads' priority in the process, depending on value of the function argu- ment. For the rtprio_thread() system call, the lwpid specifies the thread to operate on, 0 for the calling thread. The *rtp argument is a pointer to a struct rtprio which is used to specify the priority and priority type. This structure has the following form: struct rtprio { u_short type; u_short prio; }; The value of the type field may be RTP_PRIO_REALTIME for realtime priorities, RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities. The priority specified by the prio field ranges between 0 and RTP_PRIO_MAX (usually 31). 0 is the highest possible prior- ity. Realtime and idle priority is inherited through fork() and exec(). A realtime thread can only be preempted by a thread of equal or higher priority, or by an interrupt; idle priority threads will run only when no other real/normal priority thread is runnable. Higher real/idle priority threads preempt lower real/idle priority threads. Threads of equal real/idle priority are run round-robin. RETURN VALUES
The rtprio() and rtprio_thread() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The rtprio() and rtprio_thread() system calls will fail if: [EFAULT] The rtp pointer passed to rtprio() or rtprio_thread() was invalid. [EINVAL] The specified prio was out of range. [EPERM] The calling thread is not allowed to set the realtime priority. Only root is allowed to change the realtime priority of any thread, and non-root may only change the idle priority of threads the user owns, when the sysctl(8) variable security.bsd.unprivileged_idprio is set to non-zero. [ESRCH] The specified process or thread was not found or visible. SEE ALSO
nice(1), ps(1), rtprio(1), setpriority(2), nice(3), renice(8), p_cansee(9) AUTHORS
The original author was Henrik Vestergaard Draboel <hvd@terry.ping.dk>. This implementation in FreeBSD was substantially rewritten by David Greenman. The rtprio_thread() system call was implemented by David Xu. BSD
December 27, 2011 BSD
All times are GMT -4. The time now is 10:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy