LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   creating a "stop" script for a ventrilo server (https://www.linuxquestions.org/questions/linux-software-2/creating-a-stop-script-for-a-ventrilo-server-474931/)

MrSako 08-17-2006 06:37 PM

creating a "stop" script for a ventrilo server
 
im trying to create a simplified start and stop scripts for my ventrilo server so i can just execute start.script or stop.script to do either(instead of typing anything)

to start the ventrilo server is simple

#!/bin/bash

cd /usr/local/ventrilo
./ventrilo_srv -d


but the only way in which i can stop the server is using the kill command. which in order to use it i need to know the pid of ventrilo, which is different each time its ran

the pid is kept in a file in the same location called ventrilo_srv.pid and its only content is the pid of the ventrilo server.

so somehow i need to make a stop script to figure out this number when its executed to stop the server... im not sure how to do this...

jschiwal 08-17-2006 06:55 PM

You can use $(cat /usr/local/ventrilo/ventrilo_srv.pid) in the kill argument.

Just an example: kill -s SIGQUIT $(cat /usr/local/ventrilo/ventrilo_srv.pid)

I don't use this server or have it's documentation, so I couldn't tell you if SIGHUP is the best signal to send. For many services, sending SIGHUP ( The hangup signal ) will tell the server to reload its configuration file. For normal programs it will tell the program that the terminal is disconnected so it should quit.

A better solution would be to write a script that you can call with the arguments of start | stop | reload | restart. If you look at the init.d scripts, there should be a skeleton file that you can base it on. Then you could use ckconfig to have it start with you desired run modes. Also you would be able to enter something like:
"service ventrilo stop" to stop the service for example.


All times are GMT -5. The time now is 02:21 AM.