How do I create a service on Cent OS Linux?

'm having a problem, I can start up the service by hand easily check out this screenshot


Those S80policyserver and S80chatserver are the symbolic links. I don’t know what those S80’s suppose to mean… but hopefully not to important.

Here is my policyserver script, which works when I type it… but doesn’t even get ran when I restart my Parallels Power Panel

[code]#!/bin/bash

policyserver: Startup script for Policy Server Application.

chkconfig: 35 80 05

description: Startup script for Policy Server Application.

CAMSPARK_POLICY_HOME=/var/local/camsparkserver/Policy;
export CAMSPARK_POLICY_HOME

start() {
echo -n "Starting Policy Server: "
$CAMSPARK_POLICY_HOME/Policy.sh start
sleep 2
echo “done”
}

stop() {
echo -n "Stopping Policy Server: "
$CAMSPARK_POLICY_HOME/Policy.sh stop
echo “done”
}

See how we were called.

case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $“Usage: policyserver {start|stop|restart}”
exit
esac
[/code]

Why are you expecting it to get run when you restart the panel? It will get run when you restart the machine.

panel restarts the virtual pc/os anyways. When i did like

yum install mysql

it installed into the panel mysql… as a service and when i restart the panel… mysql starts up too… so i am obviously not doing something right.

can you do ‘systemctl start x’ by hand?

also does it get ran if you add the script to start up the old fashioned way?

Nope that command doesn’t exist.

But by judging what you tried to suggest me is to open control panel of some sort? I don’t have visual access to the desktop only SSH… I cannot install VNC/Remote desktop as I don’t have too much bandwidth to waste on this host.

And even if i could do it the old fashion windows way by adding something to Startup folder similar in Linux i’m guessing. Why can’t I do it the same way mysqld does it for example. My apps both java apps but still consoles which should be ran as services.

I don’t really understand what you are trying to do? Stop a service from running? It looks like you can do anything you want in that fancy control panel?

If you are trying to get something to start at boot, the general thing you do is put a script with your init scripts (on debian, /etc/init.d/) then run a command to make it install the correct symbolic links (again, on debian, the command is update-rc.d).

Of course if I just have simple scripts I need to start on boot, and not control much later other than killing them and such, I just put something like this in my /etc/crontab (make sure your cron version supports it!):

@reboot username /command/to/execute

Which, of course, runs at reboot.

or then you could stop being a nerd while you can and install WINDOWS SERBER

[quote=“sspoke, post:5, topic:422232”]But by judging what you tried to suggest me is to open control panel of some sort? I don’t have visual access to the desktop only SSH… I cannot install VNC/Remote desktop as I don’t have too much bandwidth to waste on this host.

And even if i could do it the old fashion windows way by adding something to Startup folder similar in Linux i’m guessing. Why can’t I do it the same way mysqld does it for example. My apps both java apps but still consoles which should be ran as services.[/quote]

all you need is ssh access

do this from ssh:
chkconfig policyserver --add
chkconfig policyserver on

if that works and you do “reboot” from ssh it should work fine

EDIT: is this an actual linux machine, vps or virtual host of some sort?

it is a vps running VM but i got root access to what looks like a linux os, called Cent OS.

What I believe is happening is some silent errors while policyserver is getting booted. Anyway to read these silent errors? or any script termination logs?.

Either way I did

chkconfig policyserver --add
chkconfig policyserver on

It returned nothing for both commands…

But how would I get it to show up in System Services for Parallels Infrastructure Manager.

I’ll try reboot later at night too much folks using it right now for a reboot.

Quite a few logs show up when you type ‘dmesg’, there are also more in /var/log on debian.