<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.apertium.org/w/index.php?action=history&amp;feed=atom&amp;title=Apertium-apy%2FSysvinit_issues</id>
	<title>Apertium-apy/Sysvinit issues - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.apertium.org/w/index.php?action=history&amp;feed=atom&amp;title=Apertium-apy%2FSysvinit_issues"/>
	<link rel="alternate" type="text/html" href="https://wiki.apertium.org/w/index.php?title=Apertium-apy/Sysvinit_issues&amp;action=history"/>
	<updated>2026-05-15T18:40:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.apertium.org/w/index.php?title=Apertium-apy/Sysvinit_issues&amp;diff=46386&amp;oldid=prev</id>
		<title>Firespeaker: Created page with &quot;==What we want == An init script for apertium-apy that starts the and stops the daemon, and preferably logs its stdout and stderr.  ==The problems==  === Logging === Can&#039;t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.apertium.org/w/index.php?title=Apertium-apy/Sysvinit_issues&amp;diff=46386&amp;oldid=prev"/>
		<updated>2014-01-13T22:36:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==What we want == An init script for &lt;a href=&quot;/wiki/Apertium-apy&quot; title=&quot;Apertium-apy&quot;&gt;apertium-apy&lt;/a&gt; that starts the and stops the daemon, and preferably logs its stdout and stderr.  ==The problems==  === Logging === Can&amp;#039;t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==What we want ==&lt;br /&gt;
An init script for [[apertium-apy]] that starts the and stops the daemon, and preferably logs its stdout and stderr.&lt;br /&gt;
&lt;br /&gt;
==The problems==&lt;br /&gt;
&lt;br /&gt;
=== Logging ===&lt;br /&gt;
Can&amp;#039;t figure out how to log stdout or stderr with start-stop-daemon (if it&amp;#039;s not possible I&amp;#039;ll eat my hat, but I&amp;#039;m just can&amp;#039;t find the appropriate information on how to do this)&lt;br /&gt;
&lt;br /&gt;
=== Subprocesses are not being killed when the parent process is killed ===&lt;br /&gt;
The parent process pid is kept track of and sent a kill signal.  However, the server thread(s) runs in its own pid(s), and these remain running even after the parent thread is killed.  We found what we thought is [http://tornadogists.org/4643396/ a work-around], but it seems to just make sure the parent thread and other children are killed when one child is killed.&lt;br /&gt;
&lt;br /&gt;
== The current init script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# bot initscript&lt;br /&gt;
#&lt;br /&gt;
# Last Updated: Oct 31, 2011&lt;br /&gt;
# Modified for Apertium on Jan 11, 2014&lt;br /&gt;
# If broken, yell at: firespeaker&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
### BEGIN INIT INFO&lt;br /&gt;
# Provides:             apy&lt;br /&gt;
# Required-Start:       $network&lt;br /&gt;
# Required-Stop:        $network&lt;br /&gt;
# Default-Start:        3 4 5&lt;br /&gt;
# Default-Stop:         0 1 6&lt;br /&gt;
# Short-Description:    Apertium APY, Apertium API in Python&lt;br /&gt;
### END INIT INFO&lt;br /&gt;
&lt;br /&gt;
SERVLET=&amp;quot;servlet.py&amp;quot;&lt;br /&gt;
EXEC=&amp;quot;/traductors/apertium-apy/&amp;quot;&lt;br /&gt;
ARGS=&amp;quot;-l tools/turkic.db ../pairs&amp;quot;&lt;br /&gt;
USER=&amp;quot;www-data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start_apy() {&lt;br /&gt;
    start-stop-daemon -S -c $USER -p /var/run/$SERVLET.pid -m -d $EXEC -b -x $EXEC/$SERVLET -- $ARGS&lt;br /&gt;
    SUCCESS=$?&lt;br /&gt;
    if [ $SUCCESS -gt 0 ]; then&lt;br /&gt;
        echo &amp;quot;ERROR: Couldn&amp;#039;t start $SERVLET&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    return $SUCCESS&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop_apy() {&lt;br /&gt;
    start-stop-daemon -K -p /var/run/$SERVLET.pid&lt;br /&gt;
    SUCCESS=$?&lt;br /&gt;
    if [ $SUCCESS -gt 0 ]; then&lt;br /&gt;
        echo &amp;quot;ERROR: Couldn&amp;#039;t stop $SERVLET&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    return $SUCCESS&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
    start)&lt;br /&gt;
        echo &amp;quot;Starting $SERVLET&amp;quot;&lt;br /&gt;
        start_apy&lt;br /&gt;
        ;;&lt;br /&gt;
    stop)&lt;br /&gt;
        echo &amp;quot;Stopping $SERVLET&amp;quot;&lt;br /&gt;
        stop_apy&lt;br /&gt;
        ;;&lt;br /&gt;
    restart)&lt;br /&gt;
        echo &amp;quot;Restarting $SERVLET&amp;quot;&lt;br /&gt;
        stop_apy&lt;br /&gt;
        if [ $? -gt 0 ]; then&lt;br /&gt;
            exit -1&lt;br /&gt;
        fi&lt;br /&gt;
        start_apy&lt;br /&gt;
        ;;&lt;br /&gt;
    force-reload)&lt;br /&gt;
        echo &amp;quot;Restarting $SERVLET&amp;quot;&lt;br /&gt;
        stop_apy&lt;br /&gt;
        if [ $? -gt 0 ]; then&lt;br /&gt;
            exit -1&lt;br /&gt;
        fi&lt;br /&gt;
        start_apy&lt;br /&gt;
        ;;&lt;br /&gt;
    status)&lt;br /&gt;
        if [ -e /var/run/$SERVLET.pid ]; then&lt;br /&gt;
            exit 0&lt;br /&gt;
        fi&lt;br /&gt;
        exit 3&lt;br /&gt;
        ;;&lt;br /&gt;
    *)&lt;br /&gt;
        echo &amp;quot;Usage: /etc/init.d/$SERVLET {start, stop, restart, force-reload, status}&amp;quot;&lt;br /&gt;
        exit 1&lt;br /&gt;
        ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Firespeaker</name></author>
		
	</entry>
</feed>