LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 10-17-2018, 08:53 AM   #1
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
Run A Missed or Failed Cron Job Using a Past Date Time Stamp


Hi,


Let us suppose a job named "calculate-credits.sh" is supposed to be run at these time intervals:
  • 1st Run at 6 AM
  • 2nd Run at 8 AM
  • 3rd Run at 10 AM

However, due to a system unavailability issue from 9 AM through 1 PM the 3rd job was not fired.

We identify this issue at 2 PM.

Now, we need to run the job manually. However, we want to run it with the past date-time stamp, i.e. 10 AM in this case.

How can we do that?


System Used is: CentOS 6
 
Old 10-17-2018, 09:41 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Without knowing anything about your calculate-credits.sh script or how it uses a time stamp it is impossible for anyone to know how you can do that.
 
2 members found this post helpful.
Old 10-17-2018, 10:27 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by devUnix View Post
Hi,
Let us suppose a job named "calculate-credits.sh" is supposed to be run at these time intervals:
  • 1st Run at 6 AM
  • 2nd Run at 8 AM
  • 3rd Run at 10 AM
However, due to a system unavailability issue from 9 AM through 1 PM the 3rd job was not fired. We identify this issue at 2 PM. Now, we need to run the job manually. However, we want to run it with the past date-time stamp, i.e. 10 AM in this case. How can we do that? System Used is: CentOS 6
As michaelk said, without seeing the script we can't say. But if you want to run it with a SYSTEM time-stamp of 10 AM...you should know you cannot. Cron will put the time stamp the job runs into the cron log, so unless you manually edit that file to change things, you're out of luck. If you run it manually, anything that it updates (files/directories/databases), will ALSO have the correct time, and have to be manually adjusted, if it can be. Mirroring system logs? Gotta change ALL of that manually too.

As an administrator with at least seven years experience, with many 'certifications', it's surprising you don't know these things.
 
Old 10-18-2018, 05:43 AM   #4
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
@TB0NE:


You are right. Despite all those certificates, and experiences I don't know the solution being sought here is impossible.

You know, when I posted this question here. I had this feeling. If you happened to check it out, you would copy/paste your ages old slogan about me: Many years of experiences and certificates.


I kind of got used to it long ago.


But let me tell you, when I was a beginner in the IT field, I used to ask a lot of questions. Silly questions. Impossible ones. And possible too.


It took me sometime to fall into the habit of stop asking questions on forums. I began researching on the Internet. Most of these things would be from Interviews I attended or my friends did. When I concluded that a question like this one was a product of illogical and irrational thought process, I still would have a second thought: Maybe there is something I have not looked at before. Maybe, some other person has done and seen it.

And then I turned to this group of talent pool to see if my conclusion was already valid.

Yes, my conclusion was valid but I wanted to revalidate it by posting here. Gents, you are awesome that you keep my points valid!

Now, if the same interviewer asks the same question again, I will ask him to refer to this post.


There is this command

# touch fileName

that can be used to change different time parameters of a file and we can set a past date and a future date too. You already k ow it.


But to update log files that have recent logs and then we insert past timestamps is not a logical thing to do. Even automatically.

Do you have a thing to ask interviewers who ask such illogical questions and make you look inexperienced?
 
Old 10-18-2018, 05:49 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,295
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
I share TB0ne's opinion about certifications but won't be able to express it as politely.

So instead I will ask, why not just run anacron?
 
Old 10-18-2018, 05:53 AM   #6
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by michaelk View Post
Without knowing anything about your calculate-credits.sh script or how it uses a time stamp it is impossible for anyone to know how you can do that.

Agreed.

But that was all the detail I got in the question asked by a teammate. I explained thay it was not how updating logs works. We get logs in a chronological order and reversing them in between is not a desirable thing to do.

Besides, running the same job from command line would do the work if it has no time based dependencies such as input data from other sources.

But as you might know, some interviewers would stick to their points and would not tell you their hypothetical solutions.

Thanks, anyways!
 
Old 10-18-2018, 07:38 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by devUnix View Post
@TB0NE:
You are right. Despite all those certificates, and experiences I don't know the solution being sought here is impossible.
Which makes me ask: "Why not?", and "It's NOT impossible, why don't you know the solution?"
Quote:
You know, when I posted this question here. I had this feeling. If you happened to check it out, you would copy/paste your ages old slogan about me: Many years of experiences and certificates. I kind of got used to it long ago. But let me tell you, when I was a beginner in the IT field, I used to ask a lot of questions. Silly questions. Impossible ones. And possible too.

It took me sometime to fall into the habit of stop asking questions on forums. I began researching on the Internet. Most of these things would be from Interviews I attended or my friends did. When I concluded that a question like this one was a product of illogical and irrational thought process, I still would have a second thought: Maybe there is something I have not looked at before. Maybe, some other person has done and seen it. And then I turned to this group of talent pool to see if my conclusion was already valid. Yes, my conclusion was valid but I wanted to revalidate it by posting here. Gents, you are awesome that you keep my points valid!

Now, if the same interviewer asks the same question again, I will ask him to refer to this post. There is this command
# touch fileName

that can be used to change different time parameters of a file and we can set a past date and a future date too. You already k ow it.

But to update log files that have recent logs and then we insert past timestamps is not a logical thing to do. Even automatically. Do you have a thing to ask interviewers who ask such illogical questions and make you look inexperienced?
Is there a point to this rant? Yes, I mentioned it, because you KEEP POSTING things like this. For someone with nine years experience, degrees/certifications, etc., the 'touch' command should be obvious. And you DID NOT ask how to do it automatically, did you? You asked how to do it...and you were told issues you'd have to deal with, all depending on your environment. Things that 'interviewers' would ask, like "are you syncing your log files?", etc. Things that someone with 'advanced degrees and certifications', and years of experience should know.

Again, you were told that you'd have to edit the log files. There are even 'automatic' ways to do it, using built-in commands, that you should also know. And before going on about "pasting the old slogan", try looking at your posting history:
Where you claim to have looked things up, and couldn't seem to figure out how to pipe commands, use the lp command, or write a basic script:
https://www.linuxquestions.org/quest...le-4175623648/

Where you just ask for a script:
https://www.linuxquestions.org/quest...re-4175604739/

Where you ask how to upgrade servers:
https://www.linuxquestions.org/quest...-a-4175603081/

...etc., etc. You ask VERY basic questions, and claim to have 'degrees and certifications', and work in the field professionally. Something just doesn't add up.
Quote:
But that was all the detail I got in the question asked by a teammate. I explained thay it was not how updating logs works. We get logs in a chronological order and reversing them in between is not a desirable thing to do.
Oh?? Then why didn't you mention this was from a 'teammate' at the beginning? Why didn't you post that you were just trying to come up with ideas about a seemingly impossible task, rather than just asking how to do it with (again) no details/context?
Quote:
Besides, running the same job from command line would do the work if it has no time based dependencies such as input data from other sources.
...which wouldn't affect any log files since you'd run it manually, so the question is pointless in this context.
Quote:
But as you might know, some interviewers would stick to their points and would not tell you their hypothetical solutions.
And you keep mentioning 'interviewers'. You do realize many things, such as:
  • An interviewer can accept ANY answer they'd like.
  • They can tell you (or not tell you) anything they'd like.
  • They are trying to gauge how *YOU* think about things, or would approach them.
Spin this any way you'd like. You didn't phrase it as a 'hypothetical' question, nor as something you got asked during an interview, or from a 'teammate'. Again, someone with nine years experience and many 'degrees' and 'certifications' should easily know how to do such things.

Last edited by TB0ne; 10-18-2018 at 07:46 AM.
 
Old 10-19-2018, 09:14 AM   #8
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Exclamation

Quote:
Originally Posted by TB0ne View Post
Which makes me ask: "Why not?", and "It's NOT impossible, why don't you know the solution?"

Is there a point to this rant? Yes, I mentioned it, because you KEEP POSTING things like this. For someone with nine years experience, degrees/certifications, etc., the 'touch' command should be obvious. And you DID NOT ask how to do it automatically, did you? You asked how to do it...and you were told issues you'd have to deal with, all depending on your environment. Things that 'interviewers' would ask, like "are you syncing your log files?", etc. Things that someone with 'advanced degrees and certifications', and years of experience should know.

Again, you were told that you'd have to edit the log files. There are even 'automatic' ways to do it, using built-in commands, that you should also know. And before going on about "pasting the old slogan", try looking at your posting history:
Where you claim to have looked things up, and couldn't seem to figure out how to pipe commands, use the lp command, or write a basic script:
https://www.linuxquestions.org/quest...le-4175623648/

Where you just ask for a script:
https://www.linuxquestions.org/quest...re-4175604739/

Where you ask how to upgrade servers:
https://www.linuxquestions.org/quest...-a-4175603081/

...etc., etc. You ask VERY basic questions, and claim to have 'degrees and certifications', and work in the field professionally. Something just doesn't add up.

Oh?? Then why didn't you mention this was from a 'teammate' at the beginning? Why didn't you post that you were just trying to come up with ideas about a seemingly impossible task, rather than just asking how to do it with (again) no details/context?

...which wouldn't affect any log files since you'd run it manually, so the question is pointless in this context.

And you keep mentioning 'interviewers'. You do realize many things, such as:
  • An interviewer can accept ANY answer they'd like.
  • They can tell you (or not tell you) anything they'd like.
  • They are trying to gauge how *YOU* think about things, or would approach them.
Spin this any way you'd like. You didn't phrase it as a 'hypothetical' question, nor as something you got asked during an interview, or from a 'teammate'. Again, someone with nine years experience and many 'degrees' and 'certifications' should easily know how to do such things.

You like trolling?


What do you want to prove, you moron?

You know, you are the worst kind on the earth. Dig more, you will find posts in which you were to asked to refer to RTFM by others and also many a post from me in which you said you would not answer my posts.

Even dogs change from puppies to better versions of themselves but you have been the same bent tail of a dog.


You will get sympathy from others who are like you.

Note: Loom at the first answer. He did not complain and sound rude like you.

If you don't get a thing, why do you creep your nose into it?

Stay away, you [removed] and rotten animal!

Have you ever been able to answer a question without demoralizing and ridiculing others?

WHAT DO YOU PROVE?

You scoundrel! You spoil moods of others.

STAY AWAY FROM THINGS YOUR BRAIN DOES NOT GET!

Stop Putting Multiple ? Marks. You DON'T even know English.

You are NOTHING!


I am feeling better now. What about you?

BE OFF!

Last edited by devUnix; 10-19-2018 at 09:34 AM. Reason: More Ridiculing
 
Old 10-19-2018, 09:31 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by devUnix View Post
You like trolling?
What do you want to prove, you moron? You know, you are the worst kind on the earth. Dig more, you will find posts in which you were to asked to refer to RTFM by others and also many a post from me in which you said you would not answer my posts.

Even dogs change from puppies to better versions of themselves but you have been the same bent tail of a dog. You will get sympathy from others who are like you.

Note: Loom at the first answer. He did not complain and sound rude like you. If you don't get a thing, why do you creep your nose into it? Stay away, you shit and rotten animal!
Post reported.

Again, the 'ages old slogan', as you say, isn't addressed: How does someone who claims to have advanced degrees, numerous certifications, and almost a decade of experience, not have the knowledge to do such things on their own? Or at least have an IDEA on how to do it? And if you read post #3 again, I agreed with michaelk, and also asked about your script. And gave you ideas/answers as well, and in post #7. We can only tell you things, we can't understand them for you. If they're too complicated for you, then you need to ask one of your 'teammates' for help.

There isn't much to 'dig'...your posting history speaks for itself; if you don't want to ask clear questions and show your own efforts, you need to (AGAIN) read the LQ Rules and "Question Guidelines".
Quote:
Originally Posted by devUnix
Have you ever been able to answer a question without demoralizing and ridiculing others?
Many, when they show actual effort.
Quote:
Originally Posted by devUnix
WHAT DO YOU PROVE? Shit! You scoundrel! You spoil moods of others.
STAY AWAY FROM THINGS YOUR BRAIN DOES NOT GET! Stop Putting Multiple ? Marks. You DON'T even know English. You are NOTHING! I am feeling better now. What about you? BE OFF!
There a point to your ranting??? Your post was already reported. And I 'get' how to edit log files, and the questions to ask.

Last edited by TB0ne; 10-19-2018 at 09:57 AM.
 
Old 10-19-2018, 12:51 PM   #10
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by devUnix View Post
You like trolling?


What do you want to prove, you moron?

You know, you are the worst kind on the earth. Dig more, you will find posts in which you were to asked to refer to RTFM by others and also many a post from me in which you said you would not answer my posts.

Even dogs change from puppies to better versions of themselves but you have been the same bent tail of a dog.


You will get sympathy from others who are like you.

Note: Loom at the first answer. He did not complain and sound rude like you.

If you don't get a thing, why do you creep your nose into it?

Stay away, you shit and rotten animal!

Have you ever been able to answer a question without demoralizing and ridiculing others?

WHAT DO YOU PROVE?

Shit! You scoundrel! You spoil moods of others.

STAY AWAY FROM THINGS YOUR BRAIN DOES NOT GET!

Stop Putting Multiple ? Marks. You DON'T even know English.

You are NOTHING!


I am feeling better now. What about you?

BE OFF!
Easy there, do not pop a blood vessel over a dispute with some guy from the internet. It is just not worth it.
 
2 members found this post helpful.
Old 10-19-2018, 02:47 PM   #11
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by crts View Post
Easy there, do not pop a blood vessel over a dispute with some guy from the internet. It is just not worth it.

@CRTS

That guy always is rude. There are many others who would ask for more details if they didn't get a question.

But in every reply to my posts he has been adding my experiences and certificates and humiliating.


In the last 8 years I have seen his bad comments and have not argued with him. But he has no limits. My limits of tolerating idiots are exhausted now.


He undoes the purpose of discussion here.


If he has a problem with my not being so knowledgeable then he must shut up.

@Tb0ne:


You report it to anybody. Report it to your nation's president too. I don't care. The fact remains same that you are an idiot. And this is my final warning for you as not to ever view my posts and leave your responses unless you have a good reason to do so.

You are more than welcome if you ask for more details and encourage others to do more homework before posting here. But do not ever tell them that YOU wonder why their experiences and certificates show no wit here. Now I wonder how you might have grown up in a family. Do you have children? Do you talk to like this: You have attended schools and you must already know this and that?

You leave no room for adding more knowledge. You don't even think about what the other person might be looking for. It may not be a question that needs an answer. It may be just for ensuring that what one is asking, he knows it and is double-checking it.


Anyways, I am good. You won't change. But I must not have changed my tolerance capacity from 100 to 0.

Your original response was appreciated. But the humiliation you put in there was not. It was unnecessary. Remove that part and your response deserves thanks.

Last edited by devUnix; 10-19-2018 at 02:51 PM.
 
Old 10-19-2018, 02:54 PM   #12
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by Turbocapitalist View Post
I share TB0ne's opinion about certifications but won't be able to express it as politely.

So instead I will ask, why not just run anacron?
I know that and had shared it with my teammate who had the interview. But the interviewer was looking for some other answer.

So it was kind of confusing if we were missing something.
 
Old 10-19-2018, 02:55 PM   #13
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
At the risk of being redundant (and getting flamed), I'm still waiting for the OP to respond to #2. As stated, they need to share more information about the job for any advice about how to effect running "as of" 10am at 2pm.

We can't help if you don't give us any information.
 
Old 10-19-2018, 03:03 PM   #14
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by Turbocapitalist View Post
I share TB0ne's opinion about certifications but won't be able to express it as politely.

So instead I will ask, why not just run anacron?

I added my profile 8 years ago here. With one technical certificate in my profile description. How he gets "many"?

Besides, having certificates disqualifies one from asking simple questions? Is that the rule of the forum? That is the question, mate. We are supposed to be respectful of others' opinions. This does not mean tolerate humiliation.

Thanks, for your input.
 
Old 10-19-2018, 03:17 PM   #15
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by scasey View Post
At the risk of being redundant (and getting flamed), I'm still waiting for the OP to respond to #2. As stated, they need to share more information about the job for any advice about how to effect running "as of" 10am at 2pm.

We can't help if you don't give us any information.


Nope, as I mentioned before. No more detail is available.

The job only looks for a file that has a timestamp in its name such as data_at_10.data and loads it into a MySQL database. The 10 in the file name says it is meant for the job that runs at 10 am.

I tried to get more details on the question as it is not my own question more have I directly faced it otherwise I would have strongly argued against it because crond does not fire past jobs. Anachron does that in case of the system unavailability.

So, the question was not logical. It didn't surprise me. But still wanted to see if I was not the only one to have thought that way.

Thanks!
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] File time stamp and time as printed by date showing difference MahendraL Linux - Newbie 9 04-19-2015 05:02 AM
[SOLVED] cron job to run 1st Tue of month and at random time between 3am and 4am keif Programming 6 05-29-2014 03:58 PM
[SOLVED] how do i log the start/completion (time&date) of my cron job script? davide123 Linux - Newbie 3 01-11-2010 06:25 PM
Regarding date-time-stamp problem smarty86 Programming 8 11-04-2009 09:57 PM
Howto run a job on a fixed time with cron? Schmurff Linux - Newbie 1 04-02-2004 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration