how to run this cron job
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???"
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.
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
Run the command:
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.
ok so confused and my cron job doesn't work.
below is what I have in my cronjob save as compress_test.sh
$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
/home/sde/sdeexe83/bin/sdeversion: error while loading shared libraries: libsde83.so: cannot open shared object file: No such file or directory
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:
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 08:07 PM.|