AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Source Servers (SRCDS) (https://forums.alliedmods.net/forumdisplay.php?f=130)
-   -   Linux Question (https://forums.alliedmods.net/showthread.php?t=279941)

uurbyrkdr 03-04-2016 17:44

Linux Question
 
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..

DarkDeviL 03-04-2016 19:12

Re: Linux Question
 
Quote:

Originally Posted by uurbyrkdr (Post 2399393)
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".

dgibbs 03-04-2016 19:13

Re: Linux Question
 
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'

Maxximou5 03-04-2016 19:23

Re: Linux Question
 
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


DarkDeviL 03-04-2016 20:08

Re: Linux Question
 
Quote:

Originally Posted by Maxximou5 (Post 2399430)
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. :-(

Maxximou5 03-04-2016 20:13

Re: Linux Question
 
Quote:

Originally Posted by arne1288 (Post 2399443)
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.

uurbyrkdr 03-05-2016 00:29

Re: Linux Question
 
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..


All times are GMT -4. The time now is 09:10.

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