LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Making a service/process startup by itself? (https://www.linuxquestions.org/questions/linux-newbie-8/making-a-service-process-startup-by-itself-652807/)

Flybye 07-01-2008 08:12 AM

Making a service/process startup by itself?
 
Hi all, I'm in a bit of bind and am seeking help!

I really don't know much about linux, and this is beyond my scope. I just got a virtual Linux server, and need a program to start up automatically during reboot. The program is a Ventrilo server. The file is Vent/ventsrv/ventrilo_srv

I have been told there are 3 ways to make this startup automatically. A script, a cron job, or chkconfig. My host is recommending either a cron job or chkconfig.

The only thing I've been able to try:
chkconfig
In the first SSH window, I would start up ventrilo_srv. In a 2nd SSH window, I would login as root in order to be able to use the chkconfig --list command, but ventilo_srv is not listed.

cron
The instructions I've found online seem simple enough. I figured the command line would be as simple as:
@reboot Vent/ventsrv/ventrilo_srv

But I can't find a detailed step by step guide to get out of the cron editor and have it saved. Help on the best way to do this would be greatly appreciated. :)

vishnu_sreekumar 07-01-2008 08:19 AM

Hi,
which command do you use to start the service?

Flybye 07-01-2008 08:33 AM

When I'm in the program's folder, I type ./ventrilo_srv

vishnu_sreekumar 07-01-2008 08:43 AM

since there isn't any init script to start the service, you cannot use the chkconfig method. You need to stick on to the cron job method

To edit the crontab use
# crontab -e

Now add the following line
@reboot ~/Vent/ventsrv/ventrilo_srv

Note: I assume that the script you use to start the service is in the given location under you home directory. So either use the "~" symbol or replace it with the complete path.

Flybye 07-01-2008 09:06 AM

This is where I am getting stuck at.

What do I do after typing @reboot ~/Vent/ventsrv/ventrilo_srv?

Pic of my SSH

vishnu_sreekumar 07-01-2008 09:10 AM

sorry about that. save the file, and quit the editor.
press Esc, type :wq ( Seems like it is a vi editor)

Then restart crond using this command
service crond restart

Flybye 07-01-2008 10:06 AM

Thanks! Almost there.

Another pic of my SSH

Now I just need to verify the directory. I rebooted the server and it did not start, so I'm almost sure it is a problem with the directory.

When I first logged in via SSH, and I did a DIR, I saw NOTHING. I had to create the directory public_html, and everything there is viewable by the public. Currently, when I log in via SSH and I do a DIR, I have listed Vent and public_html.

In my server's control panel, it states that my root is: /home/[user name]/public_html

Should I be putting this line in the crontab?
@reboot /home/[user name]/Vent/ventsrv/ventrilo_srv

vishnu_sreekumar 07-01-2008 10:08 AM

you have to give the complete path to the script. please check the path using pwd command.

Flybye 07-01-2008 10:56 PM

I'll never understand tech support.

Now one of the guys emailed me telling me I should be using the chkconfig command and that I should access the /etc.init.d file.

How exactly do I get to that file as the root? When I login to the root, and DIR, I see nothing.

BTW, I did try the cron command, but it doesnt seem to be working. :( I also verified the exact directory.

tungvs 07-01-2008 11:37 PM

You may try adding a new service into chkconfig list by
Code:

chkconfig --add <service_name>
then try this to see if the service appears
Code:

chkconfig --list
At last, use
Code:

chkconfig --level <something i don't remember exactly, use "man chkconfig" to discover it>
to make the service start automatically in specified runlevels.
Good luck.


All times are GMT -5. The time now is 01:44 PM.