LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 01-31-2012, 04:31 PM   #1
agentgates
LQ Newbie
 
Registered: Dec 2005
Location: Lincolnshire, UK
Distribution: Debian
Posts: 8

Rep: Reputation: 0
Question Scripting with start-stop-daemon


Hi All,

I'm hosing game servers (Ravenshield) to our clan based upon the unreal2 engine, wine and Debian Squeeze.

I wrote a script to safely start/stop multiple instances of different game servers independently from each other. I used start-stop-daemon, which is a great stuff, although I've encountered some major issues:

1. It does not create the necessary pid file in the /var/run folder, therefore I can not find out whether the corresponding server is running or not.

2. I can not access to the start-stop-daemon as a user, only as root. It is a problem as the game admins can not start/stop/restart the servers, also it is difficult to interface it with a web-based control panel. I thought maybe DBUS could do that but it's not clear in my head how I would hook them up. Any idea?

Here is the script: http://pastebin.com/VmyyzHSV

Thanks for any help or useful advices.

Last edited by agentgates; 01-31-2012 at 04:33 PM.
 
Old 01-31-2012, 10:34 PM   #2
cbtshare
Member
 
Registered: Jul 2009
Posts: 569

Rep: Reputation: 42
as root can you manually issue the commands you want and a pid file appears?
 
Old 02-01-2012, 12:48 AM   #3
agentgates
LQ Newbie
 
Registered: Dec 2005
Location: Lincolnshire, UK
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
Hello,

I ran the command before as root with & switch but there was no pid file in the /var/run. I assumed the start-stop-daemon will resolve this issue. The strange thing I noticed it runs a wine process but in the process list it appears as UCC.exe and that is how I can refer to them to kill (killall UCC.exe). But naturally I don't want to kill all of them.

So I mean the process name should be "wine" and not "UCC.exe" as wine is the actual *nix process.

As for the pid directory the pids will be in a subdir:
drwxrwxr-x 2 games games 4096 Feb 1 05:17 ucc-servers

No matter how I start the process it doesn't work either "root" or "games".

Last edited by agentgates; 02-01-2012 at 12:50 AM. Reason: typo
 
Old 02-01-2012, 02:24 AM   #4
cbtshare
Member
 
Registered: Jul 2009
Posts: 569

Rep: Reputation: 42
is there an error message when you try to start the service and no pid is found?

Quote:
tail -f /var/log/messages
 
Old 02-01-2012, 09:49 AM   #5
agentgates
LQ Newbie
 
Registered: Dec 2005
Location: Lincolnshire, UK
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
No, nothing is in the log.
 
Old 02-01-2012, 12:01 PM   #6
cbtshare
Member
 
Registered: Jul 2009
Posts: 569

Rep: Reputation: 42
I am still trying to get as much info about this from you to see which part of the script is giving problem.

so since you cant start the process by doing service start or restart I am guessing you have to then killall process and then start it again and the pid file appears?
 
Old 02-01-2012, 04:59 PM   #7
agentgates
LQ Newbie
 
Registered: Dec 2005
Location: Lincolnshire, UK
Distribution: Debian
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
so since you cant start the process by doing service start or restart I am guessing you have to then killall process and then start it again
Correct.

Quote:
the pid file appears?
No, the pid file never appears when you run the command manually:
Code:
wine UCC.exe server &
It does return with the pid number in the stdout but the pid file never appears.

I just solved this part of my problems (after hours of headache) and here is the solution. I got the impression (after your helpful guidance) somehow wine "swallows" the pid file. I went back to start-stop-daemon and my original assumption that once if it asks for a --pidfile switch then it sould create it. I read the man again (this time more thoroughly) and it says if the pid file is not created then it can be enforced externally by --make-pid. So the --pidfile switch was not adequate in this case. Now it does it but it's still unclear why wine "swallows" it.

The other part of the problems (the #2 in my original post) is still unresolved. I could make a file that the web control panel can write and make a small process running as root that's keep reading the file and excecutes the script but this is a poor design. So I would rather do it with DBUS but it's not straightforward how it works.

Last edited by agentgates; 02-01-2012 at 05:02 PM.
 
  


Reply

Tags
daemon, debian, gameserver, linux, wine


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] start-stop-daemon in Slackware? qlands Slackware 6 06-24-2011 05:03 PM
Ubuntu start-stop-daemon problem CollieJim Linux - Software 1 06-14-2011 09:44 AM
new daemon - start and stop questions zoran119 Slackware 3 11-18-2008 06:39 AM
start-stop-daemon for linux eliufoo Linux - Software 1 02-07-2008 03:12 AM
Logging with Start stop daemon bigsness Linux - General 0 01-19-2005 04:25 PM


All times are GMT -5. The time now is 11:04 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration