2013/11/7 silvioprog <silviop...@gmail.com> > 2013/11/7 silvioprog <silviop...@gmail.com> > >> Hello, >> >> 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. >> >> I followed this tutorial: >> >> http://wiki.freepascal.org/Daemons_and_Services >> >> You can download the project test in attached or in this link: >> >> https://www.dropbox.com/s/ljnq71u7lkpkz3w/daemon.zip >> >> And the shell script: >> >> https://www.dropbox.com/s/slwafuo9tj93ym7/project1.zip >> >> To test, follow these steps: >> >> 1. Compile the project1.lpr, and copy the generated executable to "/bin/"; >> 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"; >> 3. Open your browser and access: http://localhost:5445; >> >> Where am I going wrong? Some time ago I've done this test, and if I not >> mistake it worked. >> > > Seems that problem is in the script. I changed it to the draft code (based > on > http://www.linuxforums.org/forum/newbie/97097-how-create-linux-service-daemon.html) > below and it worked fine: > > #!/bin/bash > > case "$1" in > start) > # Start daemons. > echo -n "Starting /bin/project1 daemon: " > echo > start-stop-daemon -S -b -x /bin/project1 -- -r > echo > ;; > stop) > # Stop daemons. > echo -n "Shutting down /bin/project1: " > start-stop-daemon -K -x /bin/project1 -- -r > echo > # Do clean-up works here like removing pid files from /var/run, etc. > ;; > status) > status /bin/project1 > ;; > restart) > $0 stop > $0 start > ;; > *) > echo $"Usage: $0 {start|stop|status|restart}" > exit 1 > esac > exit 0 >
Final script that works fine: https://code.google.com/p/lazarus-br/source/browse/trunk/tip/linux-daemon-service-silvioprog -- Silvio Clécio My public projects - github.com/silvioprog
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal