LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-18-2011, 10:38 AM   #1
AnAsianCalledRusty
LQ Newbie
 
Registered: Jan 2011
Posts: 1

Rep: Reputation: 0
When was the script last executed?


Hey all,

I have a script scheduled to run with Crontab at 5am each weekday.

The script is all good and executes manually (is just a simple stop/start of a service)

I have reason to believe that it is not executing according to schedule.

I am looking to see when a script was last executed.

Any ideas?

**EDIT** The script is executing accordingly (long story short, I forgot it was Tuesday). I would still like to know how to check a last-execution time.

Last edited by AnAsianCalledRusty; 01-18-2011 at 10:50 AM.
 
Old 01-18-2011, 11:21 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,925

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by AnAsianCalledRusty View Post
Hey all,
I have a script scheduled to run with Crontab at 5am each weekday.
The script is all good and executes manually (is just a simple stop/start of a service) I have reason to believe that it is not executing according to schedule. I am looking to see when a script was last executed.

Any ideas?
**EDIT** The script is executing accordingly (long story short, I forgot it was Tuesday). I would still like to know how to check a last-execution time.
You don't say what version/distro of Linux you're using, but yes. Check in /var/spool/cron, and you may see a /logs or a /lastrun directory. Check the files to see what ran. The cron logs may be in a different place depending on your distro, but should be somewhere under /var. A "find /var -name *cron*" should give you a starting point.

Another low-tech idea would be to put a simple "echo $DATE >> my-crontab-script-logfile-name", and have it burp out a date (and whatever else you'd like) to a specific file after it runs each time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] read command not executed in script pjeeanah Linux - Software 3 11-02-2010 08:37 AM
Script runs if executed from CL, not from Cron Ravendark Programming 6 10-13-2010 07:07 AM
Which script gets executed? junglepunk Linux - Newbie 20 06-18-2010 09:44 AM
Getting location of the script which is currently being executed jiju.jacob Linux - Newbie 4 07-21-2008 06:48 AM
script executed inside another script dont make changes potraike Linux - Newbie 4 03-05-2008 06:27 AM


All times are GMT -5. The time now is 02:29 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration