LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 05-21-2004, 03:02 PM   #1
ashley75
Member
 
Registered: Aug 2003
Posts: 227

Rep: Reputation: 30
how to run this cron job


Hi all,

I have the below cron job and it ran as follow:

[sde@test MYDATA]$ ./compress_test.sh


ArcSDE 8.3 Build 284 Thu Jul 17 14:55:03 PDT 2003
Version Administration Utility
-----------------------------------------------------
Compress state tree: Are you sure? (Y/N):


the question is "how can you implement the Y in the option above so your job can run as schedule time???"

thank
 
Old 05-21-2004, 03:19 PM   #2
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 52
You should be able to use the "yes" command for this:

yes | ./compress_test.sh

If your script won't accept a lowercase y:

yes Y | ./compress_test.sh

Keep in mind that the yes command will keep on feeding "y"s to your program if it does
any more reads.

Lyle
 
Old 05-21-2004, 03:42 PM   #3
ashley75
Member
 
Registered: Aug 2003
Posts: 227

Original Poster
Rep: Reputation: 30
thanks for your input.

this is what I would like to do:

schedule this script into the cronjob so it can run every night

1. how can you build what you suggest along with the cron job I have in the cron tab???

2. one more favor from you, how can you trace the statistics of the job into the log file so that we will know if the job running succesfully or not????

thanks so much
 
Old 05-21-2004, 05:19 PM   #4
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 52
Run the command:

crontab -e

as the user you want the script to run as. This opens up your crontab in vi; hopefully you have the vi basics down.

You want the following to appear in your crontab:

0 1 * * * cd /path/to/MYDATA && yes | /path/to/compress_test.sh &> /path/to/"$(date --iso).compress.log"

(It should be all be on one line.)

Adjust the "/paths/to"s accordingly; they don't necessarily have to be the same. This will run it at 1:00 a.m. every night; see man crontab to adjust this. The log files will contain whatever your program outputs. The log files are prepended by the date so it won't overwrite previous nights runs and so they sort by increasing date when listed.

Lyle
 
Old 05-24-2004, 10:38 AM   #5
ashley75
Member
 
Registered: Aug 2003
Posts: 227

Original Poster
Rep: Reputation: 30
ok so confused and my cron job doesn't work.

below is what I have in my cronjob save as compress_test.sh


ORACLE_SID=mytest
export ORACLE_SID
SDEHOME=/home/sde/sdeexe83
export SDEHOME
$SDEHOME/bin/sdeversion -o compress -i esri_sde -u sde -p sde



--save this script and compress_test.sh
--change the permission so the user can execute
--I did run the script manually and it ran successfully



so now I ready to put this scripts into the cron job as follow:

10 10 * * * cd /home/sde/stuffs/scripts/mytest/ && yes | /home/sde/stuffs/scripts/mytest/compress_test.sh


and I got the below error on the mail



X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/sde>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=sde>

/home/sde/sdeexe83/bin/sdeversion: error while loading shared libraries: libsde83.so: cannot open shared object file: No such file or directory
 
Old 05-24-2004, 11:20 AM   #6
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 52
My first guess is the LD_LIBRARY_PATH environment variable isn't in the environment set up by cron to run your script.

What to do:
  1. Determine what LD_LIBRARY_PATH is set to when logged in as a user that can successfully run the script:
    echo $LD_LIBRARY_PATH.
  2. Add a line in compress_test.sh that sets LD_LIBRARY_PATH to that value (similar to the lines you already have that set environment variables.)

The LD_LIBRARY_PATH environment variable adds places to search for shared objects (also known as dynamically linked libraries).

Lyle
 
  


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to run cron job fahad26 Linux - General 3 06-30-2005 01:51 AM
Cron job to run every monday wednesday and friday...? init Linux - General 4 07-29-2004 11:24 AM
Did my Cron job run? ryedunn Linux - Newbie 2 02-25-2004 08:59 AM
Cron job does not run brentos Linux - General 6 12-12-2003 02:37 PM
how to set cron job to run every 5 mins? gsbarry Linux - General 7 05-28-2003 12:30 PM


All times are GMT -5. The time now is 12:31 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration