Here is the problem: I wrote a shell script for automatically do the file submission. This script runs great when I use command line. However, after I put it in the crontab for certain time runing, the error message I got was "System is not configured properly, unable to proceed". I don't know what's wrong with the crontab. I checked ownership, it is ok! Please help me to solve this. Thanks in advance!
my cron tab like
------------------------------------------------------------------------------------
08 01 * * * find /cvdata2/download/image -name "*upi*" -mtime +2 -exec /usr/bin/rm {} \; 2> /dev/null
#
# this makes a automatic submit tcup* files every morning every 20 min.
01,11,36,50 * * * * find /cvdata/download/image/A -name 'tcup*' |awk -F'/' '{print $6}'| xargs -i /opt/CV/etc/script/tcupsbmt /cvdata/download/image/A {} IMGREQ FILE 0x10 > /var/log/tcup.log 2> /var/log/tcup_error.log
----------------------------------------------------------------------------------
I do put the full path there.
the log file I got like
-------------------------------------------------------------------------
more /var/log/tcup.log
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
--------------------------------------------------------------------
also, 2> /var/log/tcup_error.log
have nothing in it.
When you run the script from the command line. What user are you? What are the environment variables for that user. Type env at the prompt. It should give you the variables that are set. What is the PATH of the user that you use to exe the script.
What directory is the script in? What are the directory permissions of directory that the script is in?
Put the script in a directory that is in your PATH line /usr/local/bin or /usr/bin.
When you run the script from . What user are you? What are the environment variables for that user. Type env at the prompt. It should give you the variables that are set. What is the PATH of the user that you use to exe the script.
What directory is the script in? What are the directory permissions of directory that the script is in?
Put the script in a directory that is in your PATH line /usr/local/bin or
Let me know
I run the script from the command line use root. PATH=/usr/sbin:/usr/bin
the directory the script in is /export/home/cvaradm/
the permission:
2 -rwxrwxr-x 1 root root 572 Apr 16 17:59 tcupsbmt
I put the script in /usr/bin, after run, it still show the same error message.
apcore03(43): more /var/log/tcup.log
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
System is not configured properly, unable to proceed
looks like something as it appeared before. Could you give me more help on that?
The environments in /etc/profile was loaded well, but when
the script try to load the /.profile settings the script fail. I
think that you need to review the /.profile file (near the export PATH declaration).
Another way to try to resolve the problem is to set the environment separately.
1- comment the the linesthe following lines in both scripts:
. /etc/profile
. /.profile
2- if the output of "env |grep -i cv" display lines
insert and export those lines in the .sh (script) following the set -x declaration.
3- Insert the Following to Lines in both scripts
PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/X/bin:/usr/ucb:/pub/public/sparc-sun-solaris2.7/bin:/IA/pub/GNU/sparc-sun-solaris2.7/bin:/opt/ARCHIVE/bin/sparc-sun-solaris2.7:/opt/ARCHIVE/etc/script:/opt/ARCHIVE/etc/script/sqls:/opt/ARCHIVE/etc/script/utils:/opt/ARCHIVE/etc/script/startup:/opt/ARCHIVE/etc/script/shutdown:/opt/ARCHIVE/etc/script/menu:/opt/ARCHIVE/etc/script/perl:/opt/CV/bin/sparc-sun-solaris2.7:/opt/CV/etc/script:/usr/ccs/bin:/usr/sbin:/export/home/cvaradm/bin:/usr/java/lib:/usr/java1.2/bin:/opt/WV/bin/sparc-sun-solaris2.7:/ora00/app/oracle/product/8.0.5/bin:/ora00/app/oracle/admin/scripts:/ora00/app/oracle/product/8.0.5/bin:/opt/ARCHIVE/masterdb/scripts/stat_rep:/usr/dt/bin:/usr/openwin/bin:/bin:/usr/bin:/usr/ucb:/usr/sbin:/usr/opt/SUNWmd/sbin:/usr/bin/nsr
export PATH
(Similar PATH Definition is in the /.profile)
No surrenders, give him it fights that for sure you will win him.
If the script works from the command line... my suggestion is to just simply put the entire path of all the commands in the script so you don't have to worry about environmental variables... this also makes the script easier to debug.
For example, in our scripts, we don't use chmod, we use /bin/chmod and so forth for all commands and paths.......
... you might find that a similar approach in your cron scripts makes life a bit easier ....
I find that the script cann't run on crontab is because I use one of the C program cv.initd in the script. Is there any suggestions on how to run this C program on crontab?