odd error on simpe script, server may be falling apart
i have a simple script that show the current content for cron, pretty simple, and its tested OK on another identical server.
but, heres the (stupid) error that throws when run: [root@sayri scripts]# sh ebspermits.sh : command not found 1: clear -------------------------------------------------- Seteo de permisos de archivos script : command not found 4: date -------------------------------------------------- : command not found 6: ebspermits.sh: line 41: syntax error: unexpected end of file so, how come doesnt "recognize" date or even clear i have checked the text format with cat -v ebscron_show.sh (seems ok), and bash -x ebscron_show.sh shows this: + alias 'rm=rm -i' + alias 'cp=cp -i' + alias 'mv=mv -i' + '[' -f /etc/bashrc ']' + . /etc/bashrc +++ id -gn +++ id -un +++ id -u ++ '[' root = root -a 0 -gt 99 ']' ++ umask 022 ++ '[' '' ']' + $'clear\r' : command not foundne 1: clear + echo $'--------------------------------------------------\r' -------------------------------------------------- ++ hostname -a + echo Vista de registro $'sayri\r' Vista de registro sayri + $'date\r' : command not foundne 4: date + echo $'--------------------------------------------------\r' -------------------------------------------------- + $'\r' : command not foundne 6: 'bscron_show.sh: line 29: syntax error near unexpected token `in 'bscron_show.sh: line 29: ` case $CRON in the only change i have done is add the script folder to the path and chmo'ed to 777 any help will be greatly appreciated thanks JL (original script) clear echo -------------------------------------------------- echo Vista de registro `hostname -a` date echo -------------------------------------------------- if [ "$USERNAME" != "root" ];then echo " " echo "Debe ser root para correr este script." echo "Ingrese como root y re ejecute este script para continuar." echo " " exit 1 fi cd / echo " " echo "-- Mostrando valores actuales usuario root --" crontab -u root -l|grep sh echo " " echo "-- Mostrando valores actuales usuario oracle --" crontab -u oracle -l|grep sh while : do YADA YADA ... |
One of three conditions must be met for the script to work.
1) The paths to the clear and date commands must be in the path of the user executing the script. Or 2) the script must be in the directory wherein lies the clear and date commands - difficult to do since they're probably if different directories. Or 3) edit the script to include the full path to the clear and date executable, so that bash knows where to find them. Open a terminal and run: which clear; will probably return /usr/bin/clear which date; will probably return /bin/date Edit the script to include those paths, and it should work. |
sure your trick could help overcome the situation
but, you now theres something funny about it i shouldnt happen :confused: maybe something has changed to the worse a tip i have just discover reviewing the path, it shows double routes, meaning, PATH=/usr/bin:/usr/bin/:/bin:/bin etc any help will be greatly apreciated thanks all |
All times are GMT -5. The time now is 12:12 PM. |