LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2004, 03:02 PM   #1
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Rep: Reputation: 0
Question shell script, close or not?


heres what i need done.

i have a few HL servers and i have to login and start them up manuely not really a problem, but when I'm not here and som1 needs to restart the server they don't get how-to get the HL servers back on-line.

its not a very Fancy script.

Code:
#!/bin/bash

alias w10 "wait; wait; wait; "

echo "running hlds start stript"

cd hlds
./hlds_run commands&
w10
w10
w10
w10
echo "pub server is online 1 / 4 "
w10
w10
w10
w10
cd
cd hldspriv
./hlds_run commands&
w10
w10
w10
w10
echo "priv server is online 2 / 4 "
w10
w10
w10
w10
cd
cd hltv
export command
./hltv command&
w10
w10
w10
w10
echo "hltv server is online 3 / 4 "
w10
w10
w10
w10
cd
cd dm
./hlds_run commands&
echo "deathmatch server is online 4 / 4 "
w10
w10
w10
w10
echo "servers are all online - gL and have FUN!"
any input would be great.

Last edited by [gotLan]-MarK; 10-27-2004 at 03:51 PM.
 
Old 10-27-2004, 03:27 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Code:
alias w40 "w10;w10;w10;w10"
and you save a lot of space ...
 
Old 10-27-2004, 03:47 PM   #3
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
good idea. ehh didnt even think about that.

i tryd it and it was a no go..

[mainserver@gotlan-server mainserver]$ ./hlds_run
: bad interpreter: No such file or directory

any help?
 
Old 10-27-2004, 03:52 PM   #4
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
ok it doest work for .... i added a ! be4 the /bin/bash so that why it didnt work.

but it was still a no go with the w10 wait command.
 
Old 10-27-2004, 03:57 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
What do you want w10 to do? wait waits for a proccess to exit - if you just want a 10 second pause then use sleep.
alias w10='sleep 10'
 
Old 10-27-2004, 04:57 PM   #6
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
i tryd running it and it still did nothing.

i had to call up the DataCenter and ask for a reboot.

i see alot of this error
-bash: cd: help: No such file or directory

ill change the w10 to sleep 10 and give it a shot
 
Old 10-27-2004, 05:00 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Code:
alias a=b
not
Code:
alias a b
 
Old 10-27-2004, 05:08 PM   #8
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
Code:
#! /bin/sh

echo "running hlds start stript"

cd hlds
./hlds_run -game cstrike -secure +ip 216.240.155.221 -port 27015  +maxplayers 32 +map de_dust2 -heapsize 164072&
sleep 55
echo "pub server is online 1 / 4 "
clear

cd
cd hldspriv
./hlds_run -game cstrike -secure +ip 216.240.155.222 -port 27015 +maxplayers 12 +map de_dust2 -heapsize 194072&
sleep 55
echo "priv server is online 2 / 4 "
clear

cd
cd hltv
export LD_LIBRARY_PATH=/home/mainserver/hltv:$LD_LIBRARY_PATH
./hltv -ip 216.240.155.222 +connect 216.240.155.222:27015&
sleep 55
echo "hltv server is online 3 / 4 "
clear

cd
cd dm
./hlds_run -game cstrike -secure +ip 216.240.155.223 -port 27015 +maxplayers 16 +map de_dust2 -heapsize 294144&
echo "deathmatch server is online 4 / 4 "
sleep 55
clear

echo "servers are all online - gL and have FUN!"
any better?

Last edited by [gotLan]-MarK; 10-27-2004 at 05:11 PM.
 
Old 10-27-2004, 05:09 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Code:
echo "pub server is online 1 / 4 "
clear
why bother echoing if you clear the screen 100ms later?
 
Old 10-27-2004, 05:14 PM   #10
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
i meant to flip them.

Q should i have the script not say "cd"

but to

cd /home/mainset/hlds
then the start command?

not sure if it will help but here's a pics of the structure i have going maybe it will explain what i have going in the script.

http://gotlan.net/images/ftplook.jpg

Last edited by [gotLan]-MarK; 10-27-2004 at 05:26 PM.
 
Old 10-27-2004, 05:25 PM   #11
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
using just "cd" will change back to your home directory - I have no idea what structure the other directories are in.
 
Old 10-27-2004, 05:27 PM   #12
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
darn i dont type fast i added a pic to show how that is
 
Old 10-27-2004, 05:34 PM   #13
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
In that case it should work fine although using the full paths and only one cd command wouldn't hurt. If I was you I would forget about the clear statements altogether just now until the script is working so that you can see all of the output including error messages.
 
Old 10-27-2004, 05:43 PM   #14
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
'leep: invalid time interval `2
Try `sleep --help' for more information.
: command not found:
: command not found:
: command not found: cd
: No such file or directorydspriv
: command not found
: command not found
'leep: invalid time interval `2
Try `sleep --help' for more information.
running hlds start stript
: command not found:
: command not found
: No such file or directorys
: command not found
running hlds start stript
: command not found
running hlds start stript
: command not found
: No such file or directorys
: No such file or directorys
: command not found
: command not found
running hlds start stript
: command not found
: command not found
: No such file or directorys

now i lost connection to the server.
 
Old 10-27-2004, 05:51 PM   #15
[gotLan]-MarK
Newbie
 
Registered: Oct 2004
Distribution: Fedora Core 2
Posts: 15

Original Poster
Rep: Reputation: 0
bahh its all good. only trying to makin thing's easyer not this hard!

i do it teh old way!

thank you any ways
 
  


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
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
how to close 'else' statement block in bash script servnov Linux - General 9 11-12-2004 03:53 PM
close a window with script box_l Programming 0 07-27-2004 07:57 AM
RedHat 9 Script to open and close Mozilla? ArosemenaA Linux - Newbie 21 04-29-2003 01:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:30 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
Open Source Consulting | Domain Registration