Accuracy of jobs scheduled in cron

Login or Register to Reply

 
Thread Tools Search this Thread
# 8  
I am missing something here...

I suggest you re-read JM's and vbe's posts again and absorb what they are saying...

You want realtime access through a cron job to a set of files stored somewhere iside your networking ether that are constantly being read from and written to?

I would have thought your _HDD_ thrashing I/O was the biggest bottleneck assuming that you ARE suggesting real _files_...

This is not an easy task even for the big guns...
# 9  
Quote:
Originally Posted by faka
Dear Corona, I need to parse some text files and send the results in more precise or approximate time, 1 second after the data no longer serve because they change constantly.
It is the application's job to tell you when it is done, then. Cron cannot do this, and it is not correct to assume your application is always ready at exactly the right time. What is your application?
# 10  
Quote:
Originally Posted by Corona688
It is the application's job to tell you when it is done, then. Cron cannot do this, and it is not correct to assume your application is always ready at exactly the right time. What is your application?
Corona688, first want to run this script at a certain time at the exact millisecond and get the results I asked in the first post if cron or if there is any alternative, I get the results can be either a file on disk and can also be a variable in memory.
# 11  
A little bit of lateral thinking here.
Instead of relying on the accuarcy of the cron job's timings why not create a shell script and let it run in the backround, OR, inside a visible terminal continuously...
Code:
#!/bin/sh
variable="The quick brown fox jumps over the lazy dog."
epochtime=$(date +%s)
newtime=$[ ( $epochtime + 10 ) ]

echo "$variable" > /tmp/sometext.txt
while true
do
	epochtime=$(date +%s)
	if [ $epochtime -le $newtime ]
	then
		read text < /tmp/sometext.txt
		variable=$text
		echo "Epochtime $epochtime = $(date)."
		echo "$text"
		echo "$variable"
		sleep 0.5
	else
		echo ""
		echo "Setting new time slot 10 seconds later..."
		echo ""
		epochtime=$(date +%s)
		newtime=$[ ( $epochtime + 10 ) ]
	fi
done

Results using the "sleep 0.5" in the code...
Apologies for the long printout...
Code:
Last login: Thu Dec 12 02:55:23 on ttys000
AMIGA:barrywalker~> chmod 755 timejob.sh
AMIGA:barrywalker~> ./timejob.sh
Epochtime 1386817822 = Thu 12 Dec 2013 03:10:22 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817822 = Thu 12 Dec 2013 03:10:22 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817823 = Thu 12 Dec 2013 03:10:23 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817823 = Thu 12 Dec 2013 03:10:23 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817824 = Thu 12 Dec 2013 03:10:24 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817824 = Thu 12 Dec 2013 03:10:24 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817825 = Thu 12 Dec 2013 03:10:25 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817825 = Thu 12 Dec 2013 03:10:25 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817826 = Thu 12 Dec 2013 03:10:26 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817826 = Thu 12 Dec 2013 03:10:26 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817827 = Thu 12 Dec 2013 03:10:27 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817827 = Thu 12 Dec 2013 03:10:27 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817828 = Thu 12 Dec 2013 03:10:28 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817828 = Thu 12 Dec 2013 03:10:28 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817829 = Thu 12 Dec 2013 03:10:29 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817829 = Thu 12 Dec 2013 03:10:29 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817830 = Thu 12 Dec 2013 03:10:30 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817830 = Thu 12 Dec 2013 03:10:30 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817831 = Thu 12 Dec 2013 03:10:31 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817831 = Thu 12 Dec 2013 03:10:31 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817832 = Thu 12 Dec 2013 03:10:32 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817832 = Thu 12 Dec 2013 03:10:32 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

Setting new time slot 10 seconds later...

Epochtime 1386817833 = Thu 12 Dec 2013 03:10:33 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817833 = Thu 12 Dec 2013 03:10:33 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817834 = Thu 12 Dec 2013 03:10:34 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817834 = Thu 12 Dec 2013 03:10:34 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817835 = Thu 12 Dec 2013 03:10:35 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817835 = Thu 12 Dec 2013 03:10:35 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817836 = Thu 12 Dec 2013 03:10:36 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817836 = Thu 12 Dec 2013 03:10:36 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817837 = Thu 12 Dec 2013 03:10:37 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817837 = Thu 12 Dec 2013 03:10:37 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817838 = Thu 12 Dec 2013 03:10:38 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817838 = Thu 12 Dec 2013 03:10:38 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817839 = Thu 12 Dec 2013 03:10:39 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817839 = Thu 12 Dec 2013 03:10:39 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817840 = Thu 12 Dec 2013 03:10:40 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817840 = Thu 12 Dec 2013 03:10:40 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817841 = Thu 12 Dec 2013 03:10:41 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817841 = Thu 12 Dec 2013 03:10:41 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817842 = Thu 12 Dec 2013 03:10:42 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817842 = Thu 12 Dec 2013 03:10:42 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817843 = Thu 12 Dec 2013 03:10:43 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817843 = Thu 12 Dec 2013 03:10:43 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

Setting new time slot 10 seconds later...

Epochtime 1386817844 = Thu 12 Dec 2013 03:10:44 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817844 = Thu 12 Dec 2013 03:10:44 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817845 = Thu 12 Dec 2013 03:10:45 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817845 = Thu 12 Dec 2013 03:10:45 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817846 = Thu 12 Dec 2013 03:10:46 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817846 = Thu 12 Dec 2013 03:10:46 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817847 = Thu 12 Dec 2013 03:10:47 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817847 = Thu 12 Dec 2013 03:10:47 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817848 = Thu 12 Dec 2013 03:10:48 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817848 = Thu 12 Dec 2013 03:10:48 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817849 = Thu 12 Dec 2013 03:10:49 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817849 = Thu 12 Dec 2013 03:10:49 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817850 = Thu 12 Dec 2013 03:10:50 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817850 = Thu 12 Dec 2013 03:10:50 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817851 = Thu 12 Dec 2013 03:10:51 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817851 = Thu 12 Dec 2013 03:10:51 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817852 = Thu 12 Dec 2013 03:10:52 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817852 = Thu 12 Dec 2013 03:10:52 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817853 = Thu 12 Dec 2013 03:10:53 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817853 = Thu 12 Dec 2013 03:10:53 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817854 = Thu 12 Dec 2013 03:10:54 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

Setting new time slot 10 seconds later...

Epochtime 1386817855 = Thu 12 Dec 2013 03:10:55 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Epochtime 1386817855 = Thu 12 Dec 2013 03:10:55 GMT.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
^C
AMIGA:barrywalker~> _


Last edited by wisecracker; 12-11-2013 at 10:35 PM.. Reason: Typo...
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Cron Jobs not running at scheduled time
vamshigvk475
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.... Red Hat
2
Red Hat
List all daily scheduled cron jobs from my cronfile
sureng
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...... Shell Programming and Scripting
1
Shell Programming and Scripting
where to check scheduled jobs in SunOS
dba
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....... Solaris
2
Solaris
problem when the script is scheduled to run as cron job
forumthreads
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 ...... UNIX for Dummies Questions & Answers
6
UNIX for Dummies Questions & Answers
Jobs scheduled in crontabs are not running after a migration to oracle 9i
alexcol
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....... UNIX for Advanced & Expert Users
4
UNIX for Advanced & Expert Users