[Lazarus] service launch

SPRL AFOR aforsprl at gmail.com
Mon Jun 2 17:14:26 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 ?
Yes. It was what I first suspected when I saw the error. The script 
snippet for start is:
case "$1" in
     start)
     echo -n "Starting Service test "
     ## Start daemon with startproc(8). If this fails
     ## the return value is set appropriately by startproc.
*/sbin/startproc $FOO_BIN -r *
     # Remember status and be verbose
     rc_status -v
     ;;
Yes, don't smile, I kept the original variables :-D . The $FOO_BIN 
variable contains the good program name.
BTW, as you probably noticed it, " line 48 of DaemonMapper.pas" in the 
lines above calls a logger function in the program DaemonMapper*Destroy* 
procedure !

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140602/cf7a21f4/attachment-0003.html>


More information about the Lazarus mailing list