<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 2/06/2014 16:42, Michael Van Canneyt
a écrit :<br>
</div>
<blockquote
cite="mid:alpine.DEB.2.02.1406021641390.13312@home.telenet.be"
type="cite">
<br>
<br>
On Mon, 2 Jun 2014, A. Fortuny wrote:
<br>
<br>
<blockquote type="cite">Hi Folks.
<br>
<br>
OpenSuse 12.2
<br>
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.)
<br>
When i launch it (using: # service service.test start) it fails
to launch. The /var/log/messages displays:
<br>
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: Starting Service
test Usage: /home/data2/sources/compiled/service.bin [command]
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: Where command is
one of the following:
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: -i --install To
install the program as a service
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: -u --uninstall To
uninstall the service
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: -r --run To
run the service
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: An unhandled
exception occurred at $000000000046E48A :
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: EInOutError :
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: $000000000046E48A
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: $0000000000497C43
line 233 of ../lib/simplelogger.pas
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: $0000000000473316
line 48 of DaemonMapper.pas
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: $0000000000471C27
<br>
Jun 2 11:50:02 aforsrv startproc: startproc: exit status of
parent of /home/data2/sources/compiled/service.bin: 217
<br>
Jun 2 11:50:02 aforsrv service.test[26037]: ..failed
<br>
Jun 2 11:50:02 aforsrv systemd[1]: service.test.service:
control process exited, code=exited status=7
<br>
Jun 2 11:50:02 aforsrv systemd[1]: Unit service.test.service
entered failed state.
<br>
<br>
<br>
<br>
<br>
The program itself is written in FPC using Lazarus and when
launched on its own it runs perfectly well:
<br>
# ./service.bin -r ( the -r parameter tells the program to run
as a service).
<br>
Log file is present and readable, SIGHUP and SIGTERM are trapped
and recorded. Everythning runs as expected, the service script
excepted.
<br>
<br>
Any ideas ?
<br>
</blockquote>
<br>
Does your script add the -r option when running the service ?
<br>
</blockquote>
Yes. It was what I first suspected when I saw the error. The script
snippet for start is:<br>
case "$1" in<br>
start)<br>
echo -n "Starting Service test "<br>
## Start daemon with startproc(8). If this fails<br>
## the return value is set appropriately by startproc.<br>
<b><big>/sbin/startproc $FOO_BIN -r </big></b><br>
# Remember status and be verbose<br>
rc_status -v<br>
;;<br>
Yes, don't smile, I kept the original variables <span
class="moz-smiley-s5"><span> :-D </span></span>. The $FOO_BIN
variable contains the good program name.<br>
BTW, as you probably noticed it, " line 48 of DaemonMapper.pas" in
the lines above calls a logger function in the program DaemonMapper<b><big>Destroy</big></b>
procedure !<br>
<br>
Antonio<br>
<blockquote
cite="mid:alpine.DEB.2.02.1406021641390.13312@home.telenet.be"
type="cite">
<br>
Michael.
<br>
<br>
--
<br>
_______________________________________________
<br>
Lazarus mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
<br>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection <a href="http://www.avast.com/">Antivirus avast!</a> est active.
</p>
</td>
</tr>
</table>
<br />
</body>
</html>