[Lazarus] service launch

Michael Van Canneyt michael at freepascal.org
Mon Jun 2 16:42:13 CEST 2014



On Mon, 2 Jun 2014, A. Fortuny wrote:

> Hi Folks.
>
> OpenSuse 12.2
> Based on the /etc/init.d/skeleton I've made a new service script named 
> "service.test" replacing all what is needed (binary name, conf file, etc.)
> When i launch it (using: # service service.test start) it fails to launch. 
> The /var/log/messages displays:
>
> Jun  2 11:50:02 aforsrv service.test[26037]: Starting Service test Usage: 
> /home/data2/sources/compiled/service.bin [command]
> Jun  2 11:50:02 aforsrv service.test[26037]: Where command is one of the 
> following:
> Jun  2 11:50:02 aforsrv service.test[26037]: -i --install   To install the 
> program as a service
> Jun  2 11:50:02 aforsrv service.test[26037]: -u --uninstall To uninstall the 
> service
> Jun  2 11:50:02 aforsrv service.test[26037]: -r --run       To run the 
> service
> Jun  2 11:50:02 aforsrv service.test[26037]: An unhandled exception occurred 
> at $000000000046E48A :
> Jun  2 11:50:02 aforsrv service.test[26037]: EInOutError :
> Jun  2 11:50:02 aforsrv service.test[26037]: $000000000046E48A
> Jun  2 11:50:02 aforsrv service.test[26037]: $0000000000497C43 line 233 of 
> ../lib/simplelogger.pas
> Jun  2 11:50:02 aforsrv service.test[26037]: $0000000000473316 line 48 of 
> DaemonMapper.pas
> Jun  2 11:50:02 aforsrv service.test[26037]: $0000000000471C27
> Jun  2 11:50:02 aforsrv startproc: startproc:  exit status of parent of 
> /home/data2/sources/compiled/service.bin: 217
> Jun  2 11:50:02 aforsrv service.test[26037]: ..failed
> Jun  2 11:50:02 aforsrv systemd[1]: service.test.service: control process 
> exited, code=exited status=7
> Jun  2 11:50:02 aforsrv systemd[1]: Unit service.test.service entered failed 
> state.
>
>
>
>
> The program itself is written in FPC using Lazarus and when launched on its 
> own it runs perfectly well:
> # ./service.bin -r ( the -r parameter tells the program to run as a service).
> Log file is present and readable, SIGHUP and SIGTERM are trapped and 
> recorded. Everythning runs as expected, the service script excepted.
>
> Any ideas ?

Does your script add the -r option when running the service ?

Michael.




More information about the Lazarus mailing list