0
Answered

servicebar and services

Benjamin Khoo 7 years ago updated by Eugene Pankov (Project coordinator) 7 years ago 1
hi

i am trying to make a simple plugin to start/stop my own service. However, the servicebar doesn't seem to be able to change to stop/restart button when i click on start. Even though the service is actually started. how does this work? 

i have my own init script written as a standard sysvinit style script but servicebar just can't seem to pick it up and control it. any advice?

thanks

Answer

Answer
Answered
Service bar picks service status directly from Services plugin. Depending on OS, your script must be compatible with Upstart (Debian-based) or SysV-init (Debian and RHEL).
As I guess you probably have written your script in SysV-init style, service status is detected by checking exitcode when calling /etc/init.d/xxx status.
Exitcode 0 means running, other codes mean stopped.
Answer
Answered
Service bar picks service status directly from Services plugin. Depending on OS, your script must be compatible with Upstart (Debian-based) or SysV-init (Debian and RHEL).
As I guess you probably have written your script in SysV-init style, service status is detected by checking exitcode when calling /etc/init.d/xxx status.
Exitcode 0 means running, other codes mean stopped.