Raised This Month: $51 Target: $400
 12% 

Linux Question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 03-04-2016 , 17:44   Linux Question
Reply With Quote #1

Hi.
I'm using gameservermanager's script for host the servers.
I have 3 server, and i want to start or restart all of them in 1 command.
But; for make this, i have to switch user.

For example,

Code:
su - server1
./csgoserver restart
exit
su - server2
./csgoserver restart
exit
su - server3
./csgoserver restart
exit
How can i make this with 1 command?
I tried wrote them in a .sh file, but failed.
Thanks for helps..
uurbyrkdr is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 03-04-2016 , 19:12   Re: Linux Question
Reply With Quote #2

Quote:
Originally Posted by uurbyrkdr View Post
Hi.
I'm using gameservermanager's script for host the servers.
I have 3 server, and i want to start or restart all of them in 1 command.
But; for make this, i have to switch user.

For example,

Code:
su - server1
./csgoserver restart
exit
su - server2
./csgoserver restart
exit
su - server3
./csgoserver restart
exit
How can i make this with 1 command?
I tried wrote them in a .sh file, but failed.
Thanks for helps..
Is the "csgoserver" script placed exactly as "/home/server1/csgoserver"?

Code:
ls /home/server1/csgoserver
If that command returns "No such file or directory", then it is because you are not cd'ing into the correct directory where the "csgoserver" script is.

If you are in the current directory "/tmp/testing/" with root, and you do "su -" to the user "fish", then a new shell will be started and you will be switched to the new user's home directory, e.g. "/home/fish".
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
dgibbs
Junior Member
Join Date: Feb 2014
Old 03-04-2016 , 19:13   Re: Linux Question
Reply With Quote #3

I would create a script as root and add the following...changing a needed. Or to run a non root make the 3 users part of the same group and update the permissions to include the group somthing like chown -R server1:gameservers '/home/username/

su - username -c '/home/username/gameserver restart'
dgibbs is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 03-04-2016 , 19:23   Re: Linux Question
Reply With Quote #4

The documentation exists already: https://github.com/dgibbs64/linuxgsm/wiki/Automation
Root Cron Job Example
Code:
0 5 * * *  su - csgoserver -c '/home/csgoserver/csgoserver restart' > /dev/null 2>&1
*/2 * * * *  su - csgoserver -c '/home/csgoserver/csgoserver monitor' > /dev/null 2>&1
*/5 * * * *  su - csgoserver -c '/home/csgoserver/csgoserver update' > /dev/null 2>&1
Maxximou5 is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 03-04-2016 , 20:08   Re: Linux Question
Reply With Quote #5

Quote:
Originally Posted by Maxximou5 View Post
The documentation exists already: https://github.com/dgibbs64/linuxgsm/wiki/Automation
Root Cron Job Example
So much time being wasted on writing documentations that no one cares to read anyway. :-(
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 03-04-2016 , 20:13   Re: Linux Question
Reply With Quote #6

Quote:
Originally Posted by arne1288 View Post
So much time being wasted on writing documentations that no one cares to read anyway. :-(
Tell me about it, but to be fair to him, it isn't as easy as it was to get this information. I'm just confused as to why they removed this from the installation guide. The new one simply doesn't come up to par with the old version that was used, which had all this relevant information.
Maxximou5 is offline
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 03-05-2016 , 00:29   Re: Linux Question
Reply With Quote #7

I made a start.sh with them,
Code:
su - server1 -c '/home/server1/csgoserver start'
...
and added to crontab
Code:
@reboot /root/start.sh
Now this works.
Thanks for helps..
uurbyrkdr is offline
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

Forum Jump


All times are GMT -4. The time now is 19:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode