<div dir="ltr">2013/11/7 silvioprog <span dir="ltr"><<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div><div>Hello,</div><div><br></div><div>I'm trying to use a HTTP server with daemon on Linux, but, it does not works. I did a project that is working perfectly well on Windows, but on Linux, although the service is successfully installed, it does not starts the HTTP server.</div>
</div><div><br></div><div>I followed this tutorial:</div><div><br></div><div><a href="http://wiki.freepascal.org/Daemons_and_Services" target="_blank">http://wiki.freepascal.org/Daemons_and_Services</a><br></div><div><br>
</div><div>You can download the project test in attached or in this link:<br>
</div><div><br></div><div><a href="https://www.dropbox.com/s/ljnq71u7lkpkz3w/daemon.zip" target="_blank">https://www.dropbox.com/s/ljnq71u7lkpkz3w/daemon.zip</a><br></div><div><br></div><div>And the shell script:</div><div>
<br></div><div>
<a href="https://www.dropbox.com/s/slwafuo9tj93ym7/project1.zip" target="_blank">https://www.dropbox.com/s/slwafuo9tj93ym7/project1.zip</a><br></div><div><br></div><div>To test, follow these steps:</div><div><br></div><div>
1. Compile the project1.lpr, and copy the generated executable to "/bin/";</div>
<div>2. Unzip "project1.zip", it is just a shell script, and copy if to /etc/init.d/, after execute "# chmod +x project1" and "# service project1 start";</div><div>3. Open your browser and access: <a href="http://localhost:5445" target="_blank">http://localhost:5445</a>;</div>
<div><br></div><div>Where am I going wrong? Some time ago I've done this test, and if I not mistake it worked.</div></div></blockquote></div><div><br></div><div>Seems that problem is in the script. I changed it to the draft code (based on <a href="http://www.linuxforums.org/forum/newbie/97097-how-create-linux-service-daemon.html">http://www.linuxforums.org/forum/newbie/97097-how-create-linux-service-daemon.html</a>) below and it worked fine:</div>
<div><br></div><div><div>#!/bin/bash</div><div><br></div><div>case "$1" in</div><div> start)</div><div> # Start daemons.</div><div> echo -n "Starting /bin/project1 daemon: "</div><div> echo</div>
<div> start-stop-daemon -S -b -x /bin/project1 -- -r</div><div> echo</div><div> ;;</div><div> stop)</div><div> # Stop daemons.</div><div> echo -n "Shutting down /bin/project1: "</div><div><span class="" style="white-space:pre"> </span>start-stop-daemon -K -x /bin/project1 -- -r</div>
<div> echo</div><div> # Do clean-up works here like removing pid files from /var/run, etc.</div><div> ;;</div><div> status)</div><div> status /bin/project1</div><div> ;;</div><div> restart)</div><div> $0 stop</div>
<div> $0 start</div><div> ;;</div><div> *)</div><div> echo $"Usage: $0 {start|stop|status|restart}"</div><div> exit 1</div><div>esac</div><div>exit 0</div></div><div><br></div>-- <br>Silvio Clécio<br>
My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>