LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-03-2014, 02:58 PM   #1
oraenthu@live.com
LQ Newbie
 
Registered: Sep 2012
Posts: 26

Rep: Reputation: Disabled
run from cron (echo to file) 2.6.32-400.21.1.el5uek x86_64 GNU/Linux


Hi,
the following file which resides in /home/oracle/cronscripts/batchjobs/ is being run from cron

Code:
SCRIPTS_DIR=$DIR/scripts
SCR_BASE=$HOME/cronscripts
SCR_LOC=$SCR_BASE/batchjobs
LOG_LOC=/$HOME/cronscripts/batchjobs/
LOG_FILE=$LOG_LOC/test_log.log
PATH=/usr/local/bin:/bin:/usr/bin
export PATH
echo ' **************************************************************************************************** ' >$LOG_FILE
echo ' **************************************************************************************************** ' >>${LOG_FILE}
echo " stoping process...${0} " >> ${LOG_FILE}
echo ' Time : ' `date` >> ${LOG_FILE}
echo " Executing  ...${0} " >> ${LOGFILE}
echo " Hello World ..........." >> ${LOG_FILE}
starttime=`date`
echo ' **************************************************************************************************** ' >>$LOG_FILE

This is what I get
Code:
 **************************************************************************************************** 
 **************************************************************************************************** 
 stoping process.../home/oracle/cronscripts/batchjobs/tests.sh 
 Time :  Mon Mar 3 14:32:01 CST 2014
 Hello World ...........
 ****************************************************************************************************

crontab -l|tail -3
Code:
32 14 * * * /bin/sh /home/oracle/cronscripts/batchjobs/tests.sh
the line
echo " Executing ...${0} " >> ${LOGFILE}
does not ever execute
Please help me with some clues/suggestions/answers
Any help is appreciated
 
Old 03-03-2014, 03:00 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
echo " Executing  ...${0} " >> ${LOGFILE}
You missed the underscore in the variable name: it should read LOG_FILE instead of LOGFILE.
 
1 members found this post helpful.
Old 03-03-2014, 03:05 PM   #3
oraenthu@live.com
LQ Newbie
 
Registered: Sep 2012
Posts: 26

Original Poster
Rep: Reputation: Disabled
Smile

Oh my God! This almost sucked the life out of me.
Thanks so much..
I am crying out of happiness
:-)
 
  


Reply



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
ipm timed out error on Red Hat 2.6.9-67.0.22.ELsmp #1 SMP x86_64 x86_64 x86_64 GNU/L bellnarm Linux - Newbie 0 07-07-2009 04:36 PM
cron newbie - getting simple echo script to run wakeboarder3780 Linux - Newbie 5 03-03-2009 12:57 PM
Native x86_64 Assembler for GNU/Linux? jhwilliams Linux - Software 1 06-13-2007 05:00 PM
simple "echo > qbc" cron jobs doesn't run shole Linux - Newbie 3 09-23-2006 02:09 PM
can echo be used for popups in shell scripts run by cron? dr_zayus69 Linux - Software 4 04-12-2005 06:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:43 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