LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 09-13-2012, 06:08 AM   #1
stevnnnn
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Rep: Reputation: Disabled
CentOS .sh server help


Hey, I'm quite new to CentOS/linux and I'm trying to run a server. I've installed all the required things, and the server was originally meant to be ran on windows, hence I had problems making it compatible with CentOS. The problem I'm having is that I'm not sure if my .sh is in proper format for it to launch, because it doesn't show any error nor any signs of success so I'm not too sure if it's working. Any ways, this is what happens when I launch it from terminal.
Code:
[root@xx lithium]# sh dump-items.sh
[root@xx lithium]# sh dump-mobskills.sh
dump-mobskills.sh: line 2: export: `-server': not a valid identifier
dump-mobskills.sh: line 2: export: `-Dnet.sf.odinms.wzpath=/wz': not a valid identifier
dump-mobskills.sh: line 2: export: `tools.wztosql.DumpMobSkills': not a valid identifier
[root@xx lithium]# sh dump-quests.sh
[root@xx lithium]# sh launch.sh
I've changed the dump-mobskills.sh to export CLASSPATH instead of set CLASSPATH just to test it. Here are the .sh files.

dump-items.sh
Code:
#!/bin/sh
set CLASSPATH=dist/booms.jar:mina-core.jar:slf4j-api.jar:slf4j-jdk14.jar:mysql-connector-java-bin.jar java -server -Dnet.sf.odinms.wzpath=/wz tools.wztosql.DumpItems
dump-mobskills.sh
Code:
#!/bin/sh
export CLASSPATH=/dist/booms.jar:mina-core.jar:slf4j-api.jar:slf4j-jdk14.jar:mysql-connector-java-bin.jar:bcprov-jdk16-145.jar java -server -Dnet.sf.odinms.wzpath=/wz tools.wztosql.DumpMobSkills
dump-quests.sh
Code:
#!/bin/sh
set CLASSPATH=/dist/booms.jar:mina-core.jar:slf4j-api.jar:slf4j-jdk14.jar:mysql-connector-java-bin.jar:bcprov-jdk16-145.jar java -server -Dnet.sf.odinms.wzpath=/wz tools.wztosql.DumpQuests
launcher.sh

Code:
#!/bin/sh
set CLASSPATH=/dist/booms.jar:mina-core.jar:slf4j-api.jar:slf4j-jdk14.jar:mysql-connector-java-bin.jar java -server -Dnet.sf.odinms.wzpath=/wz server.Start
When I run it in gui, the run in terminal opens and closes right away, whilst for run it doesn't show up at all. I can't think or find anything that seems to be wrong.

-Steven
 
Old 09-13-2012, 08:28 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,364

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. when writing a shell script, use multiple lines; easier to read/debug and it runs just as fast.

2. you can only export values down to sub-shells created in the parent; all of yours are running at the same level, so you can't export vars between them like that.

3. *nix is a quiet system; a cmd generally only outputs something if a) an error occurred or b) the cmd is supposed to return some data eg the ls cmd.
Otherwise its quiet.
You can check the success status using the shell special internal var '$?'
http://tldp.org/LDP/abs/html/internalvariables.html

4. Try these links
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
Old 09-14-2012, 06:27 AM   #3
stevnnnn
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hey, thanks for the reply but I am not quite sure what you just said, again I am new to CentOS/linux and this is my first time using it.
For 3. , is there a way to make it show what's on the .sh's instead of it running quiet?

-Steven
 
Old 09-14-2012, 08:18 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by stevnnnn View Post
the server was originally meant to be ran on windows, hence I had problems making it compatible with CentOS.
It's Java so that shouldn't matter, should it?


Quote:
Originally Posted by stevnnnn View Post
Code:
#!/bin/sh
set CLASSPATH=/dist/booms.jar:mina-core.jar:slf4j-api.jar:slf4j-jdk14.jar:mysql-connector-java-bin.jar java -server -Dnet.sf.odinms.wzpath=/wz server.Start
When I run it in gui, the run in terminal opens and closes right away, whilst for run it doesn't show up at all. I can't think or find anything that seems to be wrong.
The original scripts set the CLASSPATH as
Code:
export CLASSPATH=".:dist/(..):dist/
meaning "in this directory (aka $PWD) or the "dist" subdirectory", so not "/dist". Now it could be a lack of line ending conversion (see 'man dos2unix') but then the original launch script runs the lines over several lines, first setting up the requisite CLASSPATH and then executing java. If we take for instance your "dump-items.sh" it should read:
Code:
#!/bin/sh
export CLASSPATH=".:dist/booms.jar:mina-core.jar:slf4j-api.jar:slf4j-jdk14.jar:mysql-connector-java-bin.jar"
java -server -Dnet.sf.odinms.wzpath=/wz tools.wztosql.DumpItems
exit 0
* Please read the relevant documentation and ensure you understand if running a private server is in violation of the license(s).
 
1 members found this post helpful.
Old 09-14-2012, 09:13 AM   #5
stevnnnn
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you very much, sorry for being a bit clueless but I did understand and have learnt from this.

And I completely understand the consequences of hosting a private server.

Steven
 
  


Reply



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
[SOLVED] Update a CentOS 5 virtual server to CentOS 5.6 dazdaz Red Hat 4 04-10-2011 05:02 AM
Centos LAMP Server with unidentified script causing server to port scan ZS- Linux - Security 48 01-30-2011 07:27 AM
Should I be updating my CentOS 4.6 server to CentOS 5.3? Ujjain Linux - Newbie 3 04-25-2009 08:00 AM
CentOS 4 or CentOS 5 for Production Server shamimzaki Linux - Server 6 10-05-2008 01:35 AM
LXer: CentOS Directory Server On CentOS 5.2 LXer Syndicated Linux News 0 08-06-2008 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:07 AM.

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
Open Source Consulting | Domain Registration