LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-01-2005, 04:00 PM   #1
jsuarezcasana
LQ Newbie
 
Registered: Jun 2005
Location: Lima, Peru
Distribution: Red Hat EE 3.0
Posts: 2

Rep: Reputation: 0
Unhappy 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 ...
 
Old 06-01-2005, 05:11 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,877

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
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.
 
Old 06-01-2005, 09:56 PM   #3
jsuarezcasana
LQ Newbie
 
Registered: Jun 2005
Location: Lima, Peru
Distribution: Red Hat EE 3.0
Posts: 2

Original Poster
Rep: Reputation: 0
sure your trick could help overcome the situation
but, you now theres something funny about it
i shouldnt happen 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
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel Install Odd Error inescapeableus Linux - Software 13 10-22-2005 07:11 PM
FAQ: Internal Server Error / Premature End of Script Header / MS-DOS Carriage Return rebel Red Hat 2 04-30-2005 04:11 PM
odd grub error on first boot kaider Slackware - Installation 7 01-27-2005 09:48 PM
Odd error during boot up, never seen this before [42]Sanf0rd Linux - General 2 06-26-2004 06:42 PM
MySQL error, my hair is falling out! cosmicperl Linux - Software 6 09-01-2003 08:41 AM


All times are GMT -5. The time now is 01:29 PM.

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