[Lazarus] service launch

A. Fortuny aforsprl at gmail.com
Tue Jun 3 15:45:24 CEST 2014


Le 2/06/2014 16:42, Michael Van Canneyt a écrit :
>
>
> 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 ?
Yesy it does.
AT the same time I have to apologize. After re-creating the service 
script from the original /etc/init.d/skeleton,
- changing the first line as a /bin/bash script
- adapt the comments in the INIT INFO about the service name
- change the service binary program
- change the conf file name
- add the -r to the launching of the service binary file
everything runs OK;
I did forget to register the service (chkconfig) and to reload 
(systemctl --system daemon-reload)
Sorry for the annoyance and thanks anyway.

Antonio.
>
> Michael.
>
> -- 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com






More information about the Lazarus mailing list