Visit The New, Modern Unix Linux Community


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


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Cron job scheduled is running once, but reports are generating twice
# 8  
I have cross-checked it, and the cron jobs are set only once,and scripts are all fine no duplicate lines
# 9  
So as neo suggested, why don't you insert a timestamp generation logging command into the script that will write a file every time the job runs.

What's the last modified time on the duplicate output reports that you have? Are they created/modified at exactly the same time?
# 10  
Maybe something like this, just an example, in the script:

Code:
echo $(date +%s)  >> /tmp/mylogfile.txt


Code:
# echo $(date +%s)  >> /tmp/mylogfile.txt
# cat /tmp/mylogfile.txt
1561379037
# echo $(date +%s)  >> /tmp/mylogfile.txt
# cat /tmp/mylogfile.txt
1561379037
1561379165
# echo $(date +%s)  >> /tmp/mylogfile.txt
# cat /tmp/mylogfile.txt
1561379037
1561379165
1561379175

Or even something better Smilie
This User Gave Thanks to Neo For This Post:
# 11  
Thanks Neo/Hick.. giving it a try.. so logging is a remedy Smilie

--- Post updated at 12:55 AM ---

@hick ..the duplicate record is in (45 seconds),from the first one
# 12  
You need to be more specific in your analysis and posts.

For example:

Please post the last 10 entries of the DB timestamps vis-a-vis the timestamps from the script.

For example, you informed us that there is a duplicate DB entry 45 seconds from the first entry; but you did not yet inform us when the crontab runs, nor did you provide the crontab entry and nor did you provide the crontab script.

You seem to be asking for us to make up a solution or possible cause to your problem but you are not willing to provide any details.

Why not just provide the details so we can help you?
# 13  
Hi Neo,

I did cross checked it the log has that mechanism covered in it,logs are getting generated as per timestamp when its run.. and a file is created with the date time stamp for the cron scheduled.

eg logifile25062019.txt (DDMMYY)

But still on the DB side we are observing duplicate entries for that job scheduled

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #824
Difficulty: Medium
HTML 5 specifies scripting application programming interfaces (APIs) that can be used with JavaScript.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scheduled job not running automatically in crontab

i have a job scheduled in crontab. The problem is, it is not running automatically as per the time scheduled. But runs when executed manually. What would be the problem? Help me with this please. (6 Replies)
Discussion started by: Santhosh CJ
6 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 job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

4. Solaris

Cron job is not running

Hi, I have set up the crontab as follows. root@IDC4VASAPP07 # crontab -l 0-59 * * * * /var/tmp/r.sh 0-59 * * * * date >> /var/tmp/log root@IDC4VASAPP07 # r.sh is as follows. root@IDC4VASAPP07 # cat r.sh #!/bin/bash dt1=$(perl -e 'use POSIX;print strftime... (10 Replies)
Discussion started by: SunilB2011
10 Replies

5. Programming

Oracle Scheduled job not running as per schedule.

Hi, Though this is a unix forum mainly, am posting this oracle query here hoping to get a resolution. I have set up two scheduled jobs in oracle 11g for executiong a procedure in specific time intervals. One as Hourly and other as minutely. But the scheduled jobs are not running as per... (2 Replies)
Discussion started by: suresh_kb211
2 Replies

6. UNIX for Dummies Questions & Answers

Cron job not running

Hi All, I am editing crontab using -e option to add a new job Below is the line 30 * * * * scriptpath This job is not executing every thirty minutes. I have checked, cron daemon is running. What did I miss? Can some one help? I am using cron shell..ksh (7 Replies)
Discussion started by: yabhi_22
7 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. HP-UX

Cron Job Not Running

Hi, I have a cron schedule like this 04,16,28,40,52 * * * * /nag/startProcessABatch (unix script) i want to add new lines in this file (like Logging), i just copy this file into a /tmp folder (for backup copy), and i have edited this file (added few lines of code for logging). ... (1 Reply)
Discussion started by: nag_sundaram
1 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. Shell Programming and Scripting

How to implement cron job to run my reports dynamically?

How to implement cron job. Ex: I need to run SQR reports dynamically by using cron job. How can I implement cron job in shell.. If any one is having sample script in any shell that would be great help to me. Thanks Siva (1 Reply)
Discussion started by: siva
1 Replies

Featured Tech Videos