How to detect and fix why crontab job is not executed?


Login or Register to Reply

 
Thread Tools Search this Thread
# 15  
Old 2 Weeks Ago
OK. That server has been running for 2.5 years without a reboot (non uncommon for Sun servers). So that isn't your issue.
# 16  
Old 2 Weeks Ago
Quote:
Originally Posted by Don Cragun
I don't remember the name of the log file that would contain the information about when the system changes states, but there has to be one
You probably mean the file wtmp and it is typically located in /var/tmp. It is NOT plain text file. Regardless of where it exactly is (placement may vary across different OSes, always somewhere in /var) you can prints its content in a formatted way by using the last command.

Note that in some (admittedly rather rare) cases the output of uptime can be misleading because in principle it is possible to tamper with the system date: start a server with the system clock set to 1980, change the date to 2019 and it may look as if the system is up nearly 40 years. The last command will print already written time stamps from the wtmp log so that it cannot be tampered with it this way.

I hope this helps.

bakunin
# 17  
Old 2 Weeks Ago
Quote:
Originally Posted by RudiC
Why would it fail at 6:00h but work at 11:10h, then?
A possible reason might be that globs are expanded ONLY if there is something they can be expanded to:

Code:
$ touch myfileA
$ touch myfileB
$ echo myfile*
myfileA myfileB
$ echo filedoesnotexist*
filedoesnotexist*

Notice that in the second case the asterisk is preserved. It would, in the context above, then be transferred (and maybe expanded, depending on a matching file existing there) by the remote system. In other words, the whole construct is totally unpredictable because it depends on the presence as well as the absence of certain files locally AND remotely.

I hope this helps.

bakunin
# 18  
Old 2 Weeks Ago
Regarding the "system boot":
the wtmp file is certainly not in /var/tmp/ because that is world-writable and might cause security problems.
It is usually located in /var/log/ or /var/adm/
One can filter for the "reboot" records with
Code:
last reboot

(Linux SuSE by default frequently rotates wtmp regardless of its size, so the last command is rendered almost useless.)
Further the last boot is stored in the utmp file. The who command does not print it; one needs
Code:
who -b

BTW on SysV-init-compatible systems the current run level is printed with
Code:
who -r

# 19  
Old 1 Week Ago
Quote:
Originally Posted by MadeInGermany
the wtmp file is certainly not in /var/tmp/ because that is world-writable and might cause security problems.
It is usually located in /var/log/ or /var/adm/
You are right, i meant to write /var/log but wrote /var/tmp somehow.

bakunin
# 20  
Old 1 Week Ago
Hello again,

The cron job was set to 06 am but the file wasn't copied again and cronlog.err says this:

Code:
cat /path/to/cronlog.err
sshpass -p 'ThePassword' scp -r root@X.X.X.X:/path/to/files/*$ddate* /Destination/path/$dyear/$dmonth/
+ sshpass -p 'ThePassword' scp -r 'root@X.X.X.X:/path/to/files/*2019-03-06*' /Destination/path/2019/Mar/
scp: /path/to/files/*2019-03-06*: No such file or directory


I've checked yesterday on source server (SunOS) at 23:30 and after 01:00 of today and the file logfile.2019-03-06 hasn't been created at that time.

But now checking the source server appears like the logfile was created yesterday at 22:00 but like I say above after 23:00 the file wasn't there.

Code:
pwd
/path/to/LogFiles/
# ls -l | tail -5
-rw-r--r--   1 root     root      447624 Mar  2 21:16 logfile.2019-03-02
-rw-r--r--   1 root     root      163406 Mar  3 21:14 logfile.2019-03-03
-rw-r--r--   1 root     root      480599 Mar  4 22:58 logfile.2019-03-04
-rw-r--r--   1 root     root      660980 Mar  5 23:42 logfile.2019-03-05
-rw-r--r--   1 root     root      376530 Mar  6 22:00 logfile.2019-03-06

So I think the file on SunOS appears like is created yesterday but probably was created after 06:00 of today, I don't know. It confuses me since the date appears March 6 at 22:00.

Is there a way to check on SunOS really when was created on /path/to/LogFiles/ directory?
# 21  
Old 1 Week Ago
If the mtime shown with ls -l was manipulated, ls -lc will show it (it shows the ctime, the last change of the attributes).
This User Gave Thanks to MadeInGermany For This Post:
Ophiuchus (1 Week Ago)
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
Crontab job is not working ipfreak UNIX for Dummies Questions & Answers 6 03-06-2016 04:39 AM
Detect changes to crontab Junaid Subhani Shell Programming and Scripting 1 08-28-2013 05:15 AM
Crontab Job Syntax JolietJake Shell Programming and Scripting 1 06-28-2013 09:43 PM
Cron job executed at wrong time moxnos UNIX for Dummies Questions & Answers 4 12-07-2012 12:45 PM
crontab job not executed with variables turki_00 Shell Programming and Scripting 4 10-04-2012 09:01 AM
Users who desire to have their .profile executed must explicitly do so in the crontab entry. Why? thulasidharan2k Shell Programming and Scripting 1 07-29-2011 02:36 AM
Schedule a job using Crontab jatanig Shell Programming and Scripting 1 03-15-2010 09:45 AM
Log files to view job executed in Autosys -- Help ASAP sakal_woman UNIX and Linux Applications 1 05-22-2009 07:47 PM
Script errors out only when its executed via job mrx1350 Shell Programming and Scripting 6 03-26-2009 01:50 PM
Routine doesn't give output when executed in crontab SharkM Shell Programming and Scripting 1 02-12-2008 09:56 AM
Help with a crontab job!!! kumarsaravana_s Shell Programming and Scripting 4 03-28-2007 04:02 AM
bash scripting cannot executed in crontab jimmbp Shell Programming and Scripting 6 11-11-2005 10:23 AM
crontab job Moe UNIX for Dummies Questions & Answers 3 11-02-2005 04:17 PM
Shell script doesn't get executed using crontab radhika Shell Programming and Scripting 11 06-09-2005 04:28 PM
ant not being executed as cron job kingfinny Shell Programming and Scripting 5 11-12-2004 12:11 PM