Accuracy of jobs scheduled in cron

 
Thread Tools Search this Thread
Operating Systems Linux Fedora Accuracy of jobs scheduled in cron
# 8  
Old 12-11-2013
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  
Old 12-11-2013
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  
Old 12-11-2013
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  
Old 12-11-2013
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 11:35 PM.. Reason: Typo...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question