-   Linux - General (
-   -   how to run this cron job (

ashley75 05-21-2004 04:02 PM

how to run this cron job
Hi all,

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

[sde@test MYDATA]$ ./

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???"


lyle_s 05-21-2004 04:19 PM

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

yes | ./

If your script won't accept a lowercase y:

yes Y | ./

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


ashley75 05-21-2004 04:42 PM

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

lyle_s 05-21-2004 06:19 PM

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/ &> /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.


ashley75 05-24-2004 11:38 AM

ok so confused and my cron job doesn't work.

below is what I have in my cronjob save as

export SDEHOME
$SDEHOME/bin/sdeversion -o compress -i esri_sde -u sde -p sde

--save this script and
--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/

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: cannot open shared object file: No such file or directory

lyle_s 05-24-2004 12:20 PM

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 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).


All times are GMT -5. The time now is 11:39 PM.