Sponsored Content
Operating Systems Linux Fedora Accuracy of jobs scheduled in cron Post 302879214 by faka on Wednesday 11th of December 2013 09:57:57 AM
Old 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

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(1)						    BSD General Commands Manual 						 RTPRIO(1)

NAME
rtprio, idprio -- execute, examine or modify a utility's or process's realtime or idletime scheduling priority SYNOPSIS
[id|rt]prio [id|rt]prio [-]pid [id|rt]prio priority command [args] [id|rt]prio priority -pid [id|rt]prio -t command [args] [id|rt]prio -t -pid DESCRIPTION
The rtprio utility is used for controlling realtime process scheduling. The idprio utility is used for controlling idletime process scheduling, and can be called with the same options as rtprio. A process with a realtime priority is not subject to priority degradation, and will only be preempted by another process of equal or higher realtime priority. A process with an idle priority will run only when no other process is runnable and then only if its idle priority is equal or greater than all other runnable idle priority processes. Both rtprio or idprio when called without arguments will return the realtime priority of the current process. If rtprio is called with 1 argument, it will return the realtime priority of the process with the specified pid. If priority is specified, the process or program is run at that realtime priority. If -t is specified, the process or program is run as a normal (non-realtime) process. If -pid is specified, the process with the process identifier pid will be modified, else if command is specified, that program is run with its arguments. Priority is an integer between 0 and RTP_PRIO_MAX (usually 31). 0 is the highest priority Pid of 0 means "the current process". Only root is allowed to set realtime or idle priority for a process. A user may modify the idle priority of their own processes if the sysctl(8) variable security.bsd.unprivileged_idprio is set to non-zero. Note that this increases the chance that a deadlock can occur if a process locks a required resource and then does not get to run. EXIT STATUS
If rtprio execute a command, the exit value is that of the command executed. In all other cases, rtprio exits 0 on success, and 1 for all other errors. EXAMPLES
To see which realtime priority the current process is at: rtprio To see which realtime priority of process 1423: rtprio 1423 To run cron(8) at the lowest realtime priority: rtprio 31 cron To change the realtime priority of process 1423 to 16: rtprio 16 -1423 To run tcpdump(1) without realtime priority: rtprio -t tcpdump To change the realtime priority of process 1423 to RTP_PRIO_NORMAL (non-realtime/normal priority): rtprio -t -1423 To make depend while not disturbing other machine usage: idprio 31 make depend SEE ALSO
nice(1), ps(1), rtprio(2), setpriority(2), nice(3), renice(8) HISTORY
The rtprio utility appeared in FreeBSD 2.0, but is similar to the HP-UX version. AUTHORS
Henrik Vestergaard Draboel <hvd@terry.ping.dk> is the original author. This implementation in FreeBSD was substantially rewritten by David Greenman. CAVEATS
You can lock yourself out of the system by placing a cpu-heavy process in a realtime priority. BUGS
There is no way to set/view the realtime priority of process 0 (swapper) (see ps(1)). There is in FreeBSD no way to ensure that a process page is present in memory therefore the process may be stopped for pagein (see mprotect(2), madvise(2)). Under FreeBSD system calls are currently never preempted, therefore non-realtime processes can starve realtime processes, or idletime pro- cesses can starve normal priority processes. BSD
September 29, 2012 BSD
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy