LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-17-2010, 01:21 PM   #16
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208

Quote:
Originally Posted by jmdennis1987 View Post
what text doc should i use and how should i save it? like do i put . sh at the end and save it in the desired dir?
thanks so much guys
If we knew which desktop you were using we might know what programs you had available. There will be a GUI text editor; use that. The file doesn't need a .sh extension or to be executable so just save it in the same place as named after the --rcfile option. You can test the xterm -e bash --rcfile your_file_directory_and_name at the command prompt in a GUI terminal emulator.

As for setting it up to autostart it will be somewhere under the menu -> settings maybe with a name like session.

Last edited by catkin; 11-17-2010 at 01:23 PM. Reason: GU -> GUI
 
Old 11-17-2010, 06:29 PM   #17
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Rep: Reputation: 40
Quote:
Originally Posted by jmdennis1987 View Post
hey thanks.

i was also playing around but couldnt get the script to run when i loaded it manually from the home dir.

saved the scipt in my home dir and
went to the home dir
"dir" hit enter. seen it was in the folder
chmod -x file
then /.file.sh to run it
but it does nothing do i have the wrong idea about this am i doing it wrong?
Post the output of these commands:
ls -lrt /etc/rc5.d
cat /etc/rc5.d/S99mystarts
dmesg | grep mystarts
The startup script should not be in you home dir.

If you wish to test the script, in a terniaml window:
enter /etc/rc5.d/S99mystarts
enter dmesg | grep mystart
 
Old 11-17-2010, 08:20 PM   #18
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by jmdennis1987 View Post
hsaved the scipt in my home dir and
went to the home dir
"dir" hit enter. seen it was in the folder
chmod -x file
then /.file.sh to run it
but it does nothing do i have the wrong idea about this am i doing it wrong?
No and yes. Use ./file.sh. That means "run the file called file.sh in this directory". Yours means "run the file called .file.sh in the / directory".
 
Old 11-17-2010, 08:25 PM   #19
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by MrUmunhum View Post
Post the output of these commands:
ls -lrt /etc/rc5.d
cat /etc/rc5.d/S99mystarts
dmesg | grep mystarts
The startup script should not be in you home dir.

If you wish to test the script, in a terniaml window:
enter /etc/rc5.d/S99mystarts
enter dmesg | grep mystart
jmdennis1987 wants terminal windows open as administrative consoles for the games servers so a boot script is not the right solution. If it was we do not yet know which distro so it may not be using /etc/rc<n>.d directories.
 
Old 11-17-2010, 09:53 PM   #20
jmdennis1987
LQ Newbie
 
Registered: Nov 2010
Location: Vancouver, WA
Posts: 28

Original Poster
Rep: Reputation: 0
If we knew which desktop you were using we might know what programs you had available. There will be a GUI text editor; use that. The file doesn't need a .sh extension or to be executable so just save it in the same place as named after the --rcfile option. You can test the xterm -e bash --rcfile your_file_directory_and_name at the command prompt in a GUI terminal emulator.

I am useing opensuse 11.3 and am useing KDE GUI it auto logs into user joe and starts.



No and yes. Use ./file.sh. That means "run the file called file.sh in this directory". Yours means "run the file called .file.sh in the / directory".



Ok i see the difference thanks for explaining. ill try ./file.sh tomorrow on lunch.


jmdennis1987 wants terminal windows open as administrative consoles for the games servers so a boot script is not the right solution. If it was we do not yet know which distro so it may not be using /etc/rc<n>.d directories.

well the pc starts without admin i thaught. considering admin is root i am probly wrong so please tell me. but it starts up in KDE as user joe and if i whant to go into yast or udate the system anything that takes root asks for a password. my servers run without root.

thanks every one for your help. i hope this helps you help me

one question real quick i write this code like

#!/bin/sh

#
# server script
#

echo "Starting server 1"

xterm -e 'cd hlds/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27015 +maxplayers 24 +map ctf_2fort sv_pure 1 -autoupdate'

echo "Starting server 2"

xterm -e 'cd hlds1/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27025 +maxplayers 4 +map ctf_bball2 sv_pure 1 -autoupdate'

echo "Starting server 3"

xterm -e 'cd l4d2/l4d2;./srcds_run -game tf +ip 10.1.10.70 -port 27023 +maxplayers 4 -autoupdate'

#
# End
#
is that correct will that work.

Thanks

Last edited by jmdennis1987; 11-17-2010 at 09:55 PM.
 
Old 11-18-2010, 02:07 AM   #21
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by jmdennis1987 View Post
I am useing opensuse 11.3 and am useing KDE GUI it auto logs into user joe and starts.
IDK KDE but it looks as if you can make a script run when KDE starts by putting it (or a link to it) in ~/.kde/Autostart/ or ~/.kde4/Autostart/. Some info here and here.
Quote:
Originally Posted by jmdennis1987 View Post
one question real quick i write this code like

Code:
#!/bin/sh

#
# server script
#

echo "Starting server 1"

xterm -e 'cd hlds/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27015 +maxplayers 24 +map ctf_2fort sv_pure 1 -autoupdate'

echo "Starting server 2"

xterm -e 'cd hlds1/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27025 +maxplayers 4 +map ctf_bball2 sv_pure 1 -autoupdate'

echo "Starting server 3"

xterm -e 'cd l4d2/l4d2;./srcds_run -game tf +ip 10.1.10.70 -port 27023 +maxplayers 4 -autoupdate'

#
# End
#
is that correct will that work.
Almost. Like that it will wait until server 1 finishes and you close the terminal before starting server 2. Add an & at the end of each xterm command and it will do what you want:
Code:
xterm -e 'cd hlds/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27015 +maxplayers 24 +map ctf_2fort sv_pure 1 -autoupdate' &
KDE's terminal emulator is Kconsole so you might like to try using kconsole instead of xterm.
 
Old 11-18-2010, 10:35 AM   #22
jmdennis1987
LQ Newbie
 
Registered: Nov 2010
Location: Vancouver, WA
Posts: 28

Original Poster
Rep: Reputation: 0
Almost. Like that it will wait until server 1 finishes and you close the terminal before starting server 2. Add an & at the end of each xterm command and it will do what you want:

so it wont move on to the next command tell the xterm for the first command closses. ok i see since my server dont close the terminal. is eir a wait command can put in between to wait like maybe 30 sec before starting the next server?

IDK KDE but it looks as if you can make a script run when KDE starts by putting it (or a link to it) in ~/.kde/Autostart/ or ~/.kde4/Autostart/. Some info here and here.


thanks ill read on this a lil later.

thanks, u guys have been great help.
 
Old 11-18-2010, 11:08 AM   #23
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by jmdennis1987 View Post
so it wont move on to the next command tell the xterm for the first command closses. ok i see since my server dont close the terminal. is eir a wait command can put in between to wait like maybe 30 sec before starting the next server?
It will move on if you put the & at the end of the command.

sleep 30 will do what you want.

Presumably it would be nice to have all four terminals open as administrative consoles for each server ... ? EDIT: maybe even program them to change background colour if a fault is detected so you could tell at a glance ... ?

Last edited by catkin; 11-18-2010 at 11:11 AM. Reason: Removed extra [/COLOR]
 
Old 11-18-2010, 11:19 AM   #24
jmdennis1987
LQ Newbie
 
Registered: Nov 2010
Location: Vancouver, WA
Posts: 28

Original Poster
Rep: Reputation: 0
Presumably it would be nice to have all four terminals open as administrative consoles for each server ...

im confused. i dont think i need administrative permissions. i run the servers in user mode. i believe. unless im miss understanding your question. thanks.

sleep 30 will do what you want.

so the 30 stands for seconds so if i wanted to add more time just add it in seconds like sleep 120 for 2 mins?

IDK KDE but it looks as if you can make a script run when KDE starts by putting it (or a link to it) in ~/.kde/Autostart/ or ~/.kde4/Autostart/. Some info here and here.

hey i cant find the folder auto start or anything like n these. but is their a way to see waither i am using gnome or kde. it gave me the choice im sure im using kde but could be wrong. how can i check? thanks

ok here is my script
#!/bin/sh

#
# server script
#

echo "Starting server 1"

xterm -e 'cd hlds/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27015 +maxplayers 24 +map ctf_2fort sv_pure 1 -autoupdate' &

sleep 60

echo "Starting server 2"

xterm -e 'cd hlds1/orangebox;./srcds_run -game tf +ip 10.1.10.70 -port 27025 +maxplayers 4 +map ctf_bball2 sv_pure 1 -autoupdate' &

sleep 60

echo "Starting server 3"

xterm -e 'cd l4d2/left4dead2;./srcds_run -game left4dead2 +ip 10.1.10.70 -port 27023 +maxplayers 4 -autoupdate'

#
# End
#

i saved it
but when i try to run it to check that it works it tells me permission denied.
what is the proper way to execute a shell?

Last edited by jmdennis1987; 11-18-2010 at 11:42 AM. Reason: added
 
Old 11-18-2010, 11:45 AM   #25
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by jmdennis1987 View Post
im confused. i dont think i need administrative permissions. i run the servers in user mode. i believe. unless im miss understanding your question. thanks.

so the 30 stands for seconds so if i wanted to add more time just add it in seconds like sleep 120 for 2 mins?

hey i cant find the folder auto start or anything like n these. but is their a way to see waither i am using gnome or kde. it gave me the choice im sure im using kde but could be wrong. how can i check? thanks
"Administrative" with respect to the games servers, not the operating system. IDK games servers either so there's probably a more colourful term like "Game Lord"!

Yes, seconds. You can also do minutes with sleep 2m. The man sleep command gives details.

Not sure about how to check. On an old Gnome system, in the System menu, there was an About GNOME option but that was an ubuntu system and they do a lot of customisation so it may not be standard. You could try a ps -ef command and see if any of the processes have kde or gnome in their names.
 
Old 11-18-2010, 12:30 PM   #26
jmdennis1987
LQ Newbie
 
Registered: Nov 2010
Location: Vancouver, WA
Posts: 28

Original Poster
Rep: Reputation: 0
Not sure about how to check. On an old Gnome system, in the System menu, there was an About GNOME option but that was an ubuntu system and they do a lot of customisation so it may not be standard. You could try a ps -ef command and see if any of the processes have kde or gnome in their names.

i am useing KDE

also what is the proper way ro run a shell?
do i chmod -x it and do i need to give it 755 access?
cuz i can copy and past my script in a terminal and it works like i want.
but to run it with out copy and paste it into a terminal i dont know how todo.
cus when i try to run it, it says access denied.
thanks.

was playing around found start up folder runs at start up but i think my code is messed up.
it said starting server 1 and nothing starting server 2 nothing starting server 3 nothing.
so what i think is wrong is the fil dir of location.
so i guess what im asking know is what would be the code to tell it to look in a different folder then where the script is running from. the script is in auto start and i think i got the code setup to look for hlds folder in autostart folder. so how do i tell it to look in another folder then the one its in to run. hope that makes since.
thanks again.

OMG THANKS EVERYONE FOR ALL YOUR HELP
i got the code writin had to add home/joe/ to the dir got that figured out and it starts at startup like i want.
so this issue is salved and thanks for all your help.

Last edited by jmdennis1987; 11-18-2010 at 01:37 PM. Reason: added solved
 
Old 11-18-2010, 01:44 PM   #27
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Glad you got it working and hope you enjoyed the adventure of figuring it out. The Thread Tools menu can be used to mark the thread SOLVED.
 
Old 11-18-2010, 02:24 PM   #28
jmdennis1987
LQ Newbie
 
Registered: Nov 2010
Location: Vancouver, WA
Posts: 28

Original Poster
Rep: Reputation: 0
Glad you got it working and hope you enjoyed the adventure of figuring it out. The Thread Tools menu can be used to mark the thread SOLVED.

Hey thanks again yes it was really fun opened a few more doors for me to play around with shell and bash. now that i see how easy it is and how it works. ill change this thread to solved
thanks for all the help
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
When i Write commands in terminal it does nothing Ciaran Linux - Newbie 1 09-29-2010 05:06 PM
How to write a script with auto login ssh and then run commands? keber314 Linux - Server 13 02-16-2009 03:37 PM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
Write a script to run several commands ??? wahaha Linux - Software 1 04-13-2007 08:20 PM
Help to create a script to open a terminal and run commands in it. Brian1 Linux - Software 6 02-07-2005 06:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:38 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