CentOS 5 Server :: Creating New Service Scripts - PidFile?
Mar 17, 2009
I am new to linux, running a brand new centos 5.2 server. One application I want to use it for is to serve as a network host for a game my friends and I enjoy. Normally, to run the game in host mode you call the binary and pass it a port number (along with other options). To host a second instance of the game, same thing different port, you get the idea.
After doing that the binary runs in your window and dumps to stdout, so if you want it to run 24/7 you have to come up with your own strategy like nohup. Fair enough, now, I'm trying to coax the game into restarting automatically upon reboot. The most correct way to do this seemed to be to write a script for init.d so that's the road I traveled down. Now, to strain the metaphor, the pavement has ended and I'm stuck in the sand.
Here begin my questions:
I've been following the structure of other init.d scripts and I notice they all seem to call the function daemon() (contained in /etc/init.d/functions) to start their services. Looking at the structure of daemon() I see that you can pass it a user and a pidfile. The user part seems to work fine, but no pidfile is created. Let me be more specific.
Like the other scripts, I explicitly touch /var/lock/subsys/game-port on startup, which works fine. However, all of those other services seem to have a pidfile in /var/run and mine doesn't. They don't create it explicitly in their init.d script therefore I assume that some other process is creating the pidfile. At first I thought it would be the call to daemon(), since you have the option of passing it --pidfile, but that doesn't seem to work.
Are the services themselves creating the pidfile? If that's the case then I have more complications because the game binary apparently doesn't do this. Second question but probably related to the first. None of the other init.d scripts I looked at seem to do anything special to detach their services from a particular terminal session, therefore I didn't think that I would need to either.
Again I thought this was something the call to daemon() might accomplish, but either I'm wrong or I'm doing something wrong. I can probably work around this with nohup or appending '&' or something, but I'm just curious that other services like crond, sshd, named, etc., don't seem to do this. Are they determining this behavior from within the binaries themselves? I hope this is clear, as I said I'm new so I may not be getting all of the terminology correct.
View 2 Replies
ADVERTISEMENT
May 7, 2011
I am trying to create a custom service to manage a minecraft server what runs in a screen session (this is to allow easy console access as opposed to running it as a nohup background process). I am hitting two main issues with this script so far and wondering if anybody is able to shed some light on it, considering I am far from the greatest BASH scripter on Earth.
The issues are related to start and stop. the first issue with start is there is a command run "screen -dmS minecraft java -Xms1024M -Xmx1024M -jar /minecraft/minecraft.jar nogui" what doesn't appear to work, however when run from console (copy and pasted) this command seems to run perfectly. I am uncertain as to why this is not working within the script. Also if run from a script in /minecraft it also appears to work but in the minecraftd script I have created at /etc/init.d it does not work. I think the issue might be related to the location but am not certain on it, nor how to resolve it.
the second issue with stop is that it works sometimes but at other times it does not, overall it seems to work about 30~50% of the time. When it works it passes a couple of disconnection messages to the screen session and then gives the stop command (the command to gracefully terminate the minecraft server). It seems to work more often when using screen that I attach to the minecraft session while it is running but really not sure if this is an issue with my scripting or an issue with how I am passing things to screen.
The full code in /etc/init.d/minecraftd is below
Code:
#!/bin/bash
## Script Information
## Script Author: Berwick East
[code]....
View 9 Replies
View Related
Mar 29, 2010
I noticed that my VPS was rebooted recently and a new service appears
[root@localhost ~]# pstree
init─┬─brcm_iscsiuio───2*[{brcm_iscsiuio}]
View 3 Replies
View Related
Feb 7, 2011
I am in the task of migrating old linux to new linux which centos 5.5. while moving out all apps ,data etc.I need to configure SSL in apache.I have installed mod_ssl with apache 2.2. i went though some docs to configure with certificate that I have . Not sure how to start the service in 2.2. The apache/SSL was configured in my old server which apachectl. SO after importing certificatr , I do ./apachectl startssl to take in effect. In my new server , the http service is /etc/init.d/httpd, not sure how to start SSL service in centos 5.5.
[Code]...
View 2 Replies
View Related
Jun 3, 2010
I have a webservice which runs under Apache Tomcat. The service is started via a script in /etc/init.d. During the course of the Web service processing, the software must make use of the two NVIDIA GPUs on the computer to do some graphics processing. When this system is booted but not logged in, the web service is accessible but the software cannot access the software cannot access the X server to do it's processing. However, when I am logged in, the user can access the X servers and run correctly. I have tried various solutions but I always have to be logged in to run the software. I seem to have permissions problems but I'm unsure how to resolve them
Is there any way to grant permissions to root (the tomcat service is started as root) to allow it to run the software without logging in?
I am running CentOS 5.4 with Gnome display manager.
View 4 Replies
View Related
Aug 9, 2010
I been trying to install the Nvidia driver for my recently installed centos desktop but I could not find the services that I can stop. I have a gnome. did try gdm, xdgm etc etc but no luck how do I stop the x server service ? so that I can install the driver.
View 3 Replies
View Related
Feb 1, 2011
I am trying to accomplish an objective, I need to get 389 Directory server installed in the process however is it possible to just have email addresses of users in the LDAP server? I have a primary domain, example 'abcefg.com' with about 3,000 users and several hosted domains like 'xyz.com' and 'mno.com'. The end goal is to speed up email processing, so instead of the Barracuda asking the email server(s) if a user exist it queries the LDAP.
Is there a way to configure 389 Directory Server to contain just the email addresses of the end users to allow the Barracuda to poll the LDAP server to verify the email address is valid. The rest of the authentication like password is handled by the email server. So in the end the LDAP server would just contain the email addresses (live) and the Barracuda would query the LDAP asking if joebob@abcefg.com exist if it does carry on. If user xxeedd@abcefg.com does not exist drop it and go on.
View 4 Replies
View Related
Feb 17, 2009
Set up a new cluster service for a cifs share. Has these properties:
Service name = cifs_cases
Autostart is checked
name=cases type=GFS Scope=shared
[code]....
View 1 Replies
View Related
Feb 5, 2010
I just did a basic service install of Centos5 and added the RPM package install of VMware-server 2.02. but I don't the VMware service is running (based upon the flowing screen:
[root@centoshost1 vmware-mui-distrib]# ps
PID TTY TIME CMD
2925 pts/0 00:00:00 bash
22378 pts/0 00:00:00 ps
So how do i start the VM service?
View 3 Replies
View Related
Apr 24, 2010
Ok, so I have installed apache 22, mysql5.0 and proftpd1.3. When I reboot my server, the above applications do not start up automatically, and I have been trying to figure out how with out much success. know that I need to make some changes inside the init.d directory on my CentOS Server.I am running CentOS 5.4 x86_64 build.I really am not sure how to accomplish the task or where to start.
View 4 Replies
View Related
Jul 19, 2010
I have a service I've made an init script for, and it's added to chkconfig, which shows it "on" in all the correct runlevels. When I start or stop this service using the "service" command all is fine, but it does not start on it's own at bootup. I am currently at a loss to determine why it is not starting. Here is the script:
#!/bin/bash
# chkconfig: 2345 95 10
# description: Start or stop home automation
#
[Code]....
View 4 Replies
View Related
Oct 9, 2010
i meet problem on named service, i want to configure my DNS with bind...after i /etc/init.d/named statusThis shows :"rndc: connect failed: 127.0.0.1#953: connection refusednamed is stopped"
View 2 Replies
View Related
Nov 3, 2010
I have just finished bulding a virtual web hosting server on my CentOS-5.5 x86_64 linux box with several websites hosted and its working fine. Now I have to build and FTP service in this webhosting server so that i can create indviudal login for each website and provide access to thier respective web directory only. This is where I am stuck. I have been trying to find out some docs and instructions to achieve this but in vain.
What I need is to configure an FTP service in the web server so that individual owner of websites can login to thieir respective web directories only and upload and download files as well as create, delete and modify the contents of their web directory.
View 1 Replies
View Related
Jul 23, 2009
I've a java program which needs to be executed regardless of whether a user is logged in or not. Currently I've a shell script which executes the java program. I login to the server and run this shell script when the server is rebooted. I would like to start this script automatically preferably as a service so that I can stop and restart this service whenever I update the java program.
View 3 Replies
View Related
Dec 8, 2009
There is a particular java app called LanguageTool which we need to host on our centos server. Other applications are supposed to send an http request to this machine; this machine should pass this data (received over the http request) to the java application concerned, obtain the output from the app; and then send this response back to the requesting client...
We need to set this app as a service on startup. The centos machine might restarted from time to time; so we expect this service should startup automatically. What can I do to get this done?
View 1 Replies
View Related
Feb 9, 2010
For the first time in installed and configured centos-ds from this HowTos and from the manuals.It is running nicely but disabled my httpd.Is it not possible to run directory service and httpd in the same machine
View 3 Replies
View Related
Apr 22, 2011
I installed centos 5.5 and httpd service was working well for the last 2 weeks till yesterday. I restarted server and noted my hosting service were not working. I have tried service httpd restart on the terminal and it dispalys [FAILED]. I updated my machine and and have tried restarting it but it doesn't work. I am new to centos and I dont know how to solve this.
View 2 Replies
View Related
Oct 12, 2010
I meet this problem after i reformat the CentOS 5...I havent do any configuration, the named service start failed ? why ....
View 2 Replies
View Related
Jul 12, 2011
I have created a ftp user in centos 5,but it got all permissions to delete files in other location,view the entire directory and create any folder in every place. How to deny this permissions to the particular user.And please help me to give permissions only to a specified location given by the root.
View 4 Replies
View Related
Nov 24, 2009
I'm running VNC Server on CentOS5 on a brand new installation, this is for some of my students to use specific software via VNC on their machines from home that they otherwise don't have access to on their Windows machines. This has been working fine on our previous server for a few years but the hardware is now outdated so I have upgraded and put a fresh install of CentOS 5 on. This works fine for about 24 hours and then eventually one of the session ends up freezing where the user then can see everything on their session, the cursor can move but they cant click a single thing.
View 1 Replies
View Related
Jun 7, 2011
Tearing my hair out on this one a little bit, having problems sending message from web based PHP form to user inbox.I keep getting: Undelivered Mail Returned to Sender<me@mydomain.co.uk>: Host or domain name not found. Name service error for name=mydomain.co.uk type=A: Host not found.Running these commands:
$ hostname = mydomain.co.uk
$ hostname -f = mydomain.co.uk
$ postconf -n =
[code]....
View 6 Replies
View Related
Mar 16, 2009
I had installed PHP using yum install php. I am trying to use the pdf_new function to create pdfs from existing text files, but I get this error PHP Fatal error: Call to undefined function pdf_new()I have noticed that when I run the phpinfo() command, I cannot find the PDF phrase at all. My php.ini file does not even have these two linesextension=php_pdf.dll extension=php_cpdf.dll kind of command I should use if I need to build PDFs using PHP on Centos 5?
View 1 Replies
View Related
Feb 12, 2011
Wondering if the internal network will benefit of connecting to a local DNS server, rather than my ISP dns server. Can I create this local DNS server, without having an external domain, pointing to my server ?
All I want is faster lookup of known hostnames, both internally (hostnames) and externaly (cnn.com etc..)
View 10 Replies
View Related
May 10, 2010
I wrote a script for capturing port 5060 with tshark.Well, it's only a line, but I needed to send a positional var, and I couldn't do it with an alias. Now I need that script to run as a service, so I can start/stop. (Using CentOS)
Code:
#!/bin/bash
#
# capture service
[code]....
One more thing, my goal is to start/stop the service with
Code:
service myservice start|stop
Is that possible? I read that I must use chkconfig.
View 1 Replies
View Related
Aug 1, 2011
We have a squid-proxy configured with 1 delay pool to limit the bandwith to 6M. I have to create a kind of exception for a specific
remote host for which we want to reserve 1M which is not included within the 6M. How should I do that? Here is our actual configuration of the delay pools
acl all_network src 0.0.0.0/0.0.0.0
delay_pools 1
delay_class 1 1
[code]....
View 1 Replies
View Related
Jul 10, 2009
I've just discovered that crontab is creating a new file in the root directory every time it executes a cronjob, and it doesn't erase over the old file so there are thousands of files in the root directory, they have the same name as the script file (appended with a numeral) but are all blank.here is what one of the cronjob's looks like[URL]
View 10 Replies
View Related
Apr 26, 2011
urgentlyostfix status:[COLOR="DarkRed"]master dead but pid file exist[/COLOR]
View 1 Replies
View Related
Mar 13, 2009
I have two folders as :
drwxrwxrwx 2 root root 1368064 Mar 10 18:28 monitor
drwxrwxrwx 7 root root 12288 Feb 18 17:07 monitorDONE
I have created one short cut link for this folder with below command :
ln -s monitorDONE recordings lrwxrwxrwx 1 root root 11 Mar 13 14:30 recordings -> monitorDONE This link is under /var/www/html Now, when I do IP/recordings It show me an Error as Forbidden You don't have permission to access /recordings on this server.
View 19 Replies
View Related
Apr 16, 2010
I am installing a cluster which is hidden from the rest of the world and there is no router either froma general login node. I would therefore require a local repository of the updates to CentOS5.4. When I checked I only found instructions for a full mirror. As I have no room and neither the human resources to setup and maintain a full-blown mirror, this is not a solution. However if I try to find updates for 5.4 to download in a repository-type of way I fail to find a solution. Maybe I am just not looking in the right places.
View 1 Replies
View Related
Mar 23, 2010
I am looking to create a user to be able to do WinSCP or SSH into the system and only be able to see /var/www/html/joomla/ and that is it. I don't want them to be able to start or stop service but be able to upload and download files to the specific directory or change privileges of the mentioned directory. Is that possible? what commands should I run.
View 1 Replies
View Related