Solved

cron does not run files at scheduled times

Posted on 2008-10-03
13
314 Views
Last Modified: 2013-12-27
I have a SUN T2000 SOLARIS 10 and have been trying to get just a simple script to run in cron.
Nothing happens.  I do a ps -ef |grep cron
 # ps -ef |grep cron
    root   384     1   0   Sep 21 ?           0:03 /usr/sbin/cron
so it appears to be running.
Any suggestions as to why nothing is executed from cron?
I just put a script in there that simple echos a few lines to a file but that does not happen.
On my production T2000 SOLARIS 10 this same script runs fine.

Thanks
0
Comment
Question by:bkreynolds48
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 5

Expert Comment

by:si_shamil
ID: 22635963
What is the output of "crontab -l" command?
0
 
LVL 22

Expert Comment

by:blu
ID: 22635996
You are not giving us much to go on, are you? I think you need to be more specific about your particular issue. Right now all we have is
"cron is running. My script isn't. Why?"

What does your script look like? Which crontab is it in? What does the entry look like?  Have you looked in the cron log file under /var/cron?
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 22636040
# FORMAT: Minute Hours Day Month Day-of-Week Script-to-Execute
#
# -- Remember to code all time in GMT not CST ---
#------------------------------------------------------------
00 01 * * 5 /export/home/oracle/bev/bin/cleanup_logs.sh
40 15 * * * /export/home/oracle/bev/bin/cleanup_arcs.sh
00 05 * * 5 /export/home/oracle/bev/bin/bcklistener.sh
00 07 * * 5 /export/home/oracle/bev/bin/bckcron.sh
18 17 * * 1-6 /usr/bin/sh /var/tmp/b.sh  2>&1 >/var/tmp/b.log

oracle /240 cat /var/tmp/b.sh
#######################################################################
#
#!/bin/sh
#
DBA1='breynolds@cymtec.com';export DBA1
#
PATH=$PATH:/usr/bin:/usr/sbin/:/sbin:/bin:/usr/opt/networker/bin; export PATH
LOGPATH=/var/tmp; export LOGPATH
#
DATED=`date "+%m%d%y"`
TP=`date "+%m-%d-%y"`
LOGFILE=$LOGPATH/bev.$DATED; export LOGFILE
#
echo Start: `date +"%d/%m/%y %H:%M"` > $LOGFILE 2>&1
echo $DATED >>$LOGFILE
echo $TP >>$LOGFILE
#
####################### End of Script #################################
 
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 5

Expert Comment

by:si_shamil
ID: 22636067
The script will run only on 17:18 every day except sunday.

Are you in the time window,  to check if it working?
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 22636078
I keep changing the time trying to get it executed.
This script is just for testing because nothing is running from cron.
I did a svcs -a |grep cron and the service is online.
I did a svcadm restart cron as well but nothing runs.
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 22636090
One thing I forgot to mention is that I had to change /etc/TIMEZONE to be GMT - it was CDT - I just vi ed the file to make the change  - is that a problem?
0
 
LVL 5

Expert Comment

by:si_shamil
ID: 22636099
change the line on to this:

* * * * /usr/bin/sh /var/tmp/b.sh  2>&1 >/var/tmp/b.log

it will run script every minute

then check your log "/var/tmp/b.log"
and check also cron log...
0
 
LVL 1

Author Comment

by:bkreynolds48
ID: 22636124
that ran
* * * * /usr/bin/sh /var/tmp/b.sh  2>&1 >/var/tmp/b.log

Does that mean something is messed up on the time because I changed the TIMEZONE file?
0
 
LVL 5

Expert Comment

by:si_shamil
ID: 22636164
TIMEZONE can affect the schedule. but it still will run.
Also you should read the crontab format manual to understand how to create cron scheduled jobs
0
 
LVL 22

Accepted Solution

by:
blu earned 125 total points
ID: 22636314
How are you editing the crontab file? Are you using the crontab -e command to do it?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22637026
try to stop and start the cron daemon? changing timezone might have confused cron.

0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 125 total points
ID: 22637042
If I remember correctly, changing the system time use to cause cron to misbehave in earlier versions of solaris
0
 
LVL 1

Author Closing Comment

by:bkreynolds48
ID: 31502840
a reboot fixed the problem
Thanks
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question