LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 08-22-2004, 09:24 PM   #1
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 612

Rep: Reputation: 33
mysql batch file won't work... bug?


ok this is weird... I'm trying to execute a script and this is what I get:

Code:
[root@mailserver temp]# ./scadalog_put
: No such file or directoryta/shared/scadadump.sql
: command not founde 2: 
[root@mailserver temp]#
The script is:

Code:
/usr/local/mysql/bin/mysql -h localhost -D business -uroot -p12345678 </data/shared/temp/scadadump.sql
All the paths are right since if I do it manually it works.

Anyone know what the heck is going on? Should I just reinstall red hat, since obviously something is way wrong. command not founde !?


More BS behaviour:

Code:
echo restoring forum...
/usr/local/mysql/bin/mysql -u root -p12345678 -h localhost iceteks_reliexec</data/shared/temp/forum.sql

echo restoring articles
/usr/local/mysql/bin/mysql -u root -p12345678 -h localhost iceteks_articles</data/shared/temp/articles.sql

echo restoring scada
/usr/local/mysql/bin/mysql -u root -p12345678 -h localhost iceteks_scada</data/shared/temp/scada.sql

echo restoring front page news
/usr/local/mysql/bin/mysql -u root -p12345678 -h localhost icetek_frontpagenews</data/shared/temp/news.sql

echo done

WTF? If I copy and paste it in the console, it works... but I don't want to do that, I want to be able to just type the script name and boom, it executes all of it.

Oh and it keeps referring to lines that don't even have anything in them.

Code:
restoring forum...
: No such file or directory /data/shared/temp/forum.sql
: command not found line 3: 
restoring articles
: No such file or directory /data/shared/temp/articles.sql
: command not found line 6: 
restoring scada
: No such file or directory /data/shared/temp/scada.sql
: command not found line 9: 
restoring front page news
: No such file or directory: /data/shared/temp/news.sql
: command not found line 12: 
done
: command not found line 14:


If I just remove the spaces, it still screws around with me.

Code:
restoring forum...
: No such file or directory /data/shared/temp/forum.sql
restoring articles
: No such file or directory /data/shared/temp/articles.sql
restoring scada
: No such file or directory /data/shared/temp/scada.sql
restoring front page news
: No such file or directory /data/shared/temp/news.sql
done
[root@mailserver temp]#

This thing is screwed up real good. Is there a way I can fix this? Do I need to reinstall anything? Obviously something is WAY wrong. And everything is right, I checked a million times. I can open those paths no problem so I have no clue what the hell it's trying to say that it's "not founde" (spelling mistake too)
 
Old 08-22-2004, 09:47 PM   #2
AltF4
Member
 
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 30
try putting this in the first line of your script:
--------------------------------------------
#!/bin/sh
your script here ....
--------------------------------------------
 
Old 08-22-2004, 10:10 PM   #3
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 612

Original Poster
Rep: Reputation: 33
What does that mean?

Tried it but I just get:

: bad interpreter: No such file or directory
 
Old 08-22-2004, 10:17 PM   #4
AltF4
Member
 
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 30
linux needs to know the interpreter used to run your script

-) test your script with "bash ./scadalog_put"

-) add a single ":" character or "#!/bin/bash" as the first (!) line of your script
 
Old 08-22-2004, 10:22 PM   #5
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 612

Original Poster
Rep: Reputation: 33
Tried all, still no luck. same errors.
 
Old 08-22-2004, 10:37 PM   #6
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 612

Original Poster
Rep: Reputation: 33
BTW I have a ton of other scripts and they work fine, but suddently new ones that I make just decided to start acting up on me like this. It's a real piss off. I think the only solution is to do it manually every time, maybe I can just keep the lines in a file and I just copy and paste them each time. Scripts pretty much defeat their own purpose if they don't even work with all commands.
 
Old 08-23-2004, 01:21 PM   #7
AltF4
Member
 
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 30
did you edit the scripts under MSDOS ?

try "cat -v scriptname" and look for "^M"

"unix2dos" can convert dos <--> unix
 
Old 08-23-2004, 04:29 PM   #8
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 612

Original Poster
Rep: Reputation: 33
No I just used winsyntax which is a text editor for windows, then I uploaded it using ssh. To make small changes I use vim through ssh.
 
Old 08-23-2004, 05:01 PM   #9
AltF4
Member
 
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532

Rep: Reputation: 30
that's it

once it's in DOS format, vim keeps dos format

use "dos2unix myscript" to convert to unix format and retry
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sftp using a batch file JeRrYmAn Linux - Security 2 05-05-2006 10:15 AM
How to create a batch file? Franziss Programming 8 05-16-2005 12:36 AM
batch file for chmod's? teodavinci Linux - Newbie 3 08-13-2004 03:04 PM
phpmyadmin (or regular mysql) batch column edit? fibbi Linux - Software 1 07-10-2004 02:06 PM
MySQL in batch mode ganninu Linux - General 1 11-20-2003 05:49 AM


All times are GMT -5. The time now is 02:27 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration