Note: You are currently viewing documentation for Moodle 3.9. Up-to-date documentation for the latest stable version of Moodle may be available here: mod/assign/feedback/editpdf/testunoconv/upstart.

mod/assign/feedback/editpdf/testunoconv/upstart: Difference between revisions

From MoodleDocs
(Created page with "= Upstart script example for unoconv on ubuntu = Back to unoconv installation This script can be installed to /etc/init/unocon...")
 
Line 21: Line 21:
author          "Damyon Wiese <damyon@moodle.com>"
author          "Damyon Wiese <damyon@moodle.com>"


start on runlevel [2345]
start on filesystem or runlevel [2345]
stop on starting rc RUNLEVEL=[016]
stop on starting rc RUNLEVEL=[016]


Line 35: Line 35:
     # Kill any currently running soffice processes.
     # Kill any currently running soffice processes.
     /usr/bin/killall soffice.bin || true
     /usr/bin/killall soffice.bin || true
    # Service logging when starting
    echo "[`date`] Starting unoconv service" >> /var/log/unoconv.log
end script
script
    # pid file...
    echo $$ > /var/run/unoconv.pid
    exec usr/bin/unoconv --listener
end script
end script


exec /usr/bin/unoconv --listener
pre-stop script
    # Remove pid file first
    rm /var/run/unoconv.pid
    # Service logging when stopping
    echo "[`date`] Stopping unoconv service" >> /var/log/unoconv.log
end script
</pre>
</pre>


[[ mod/assign/feedback/editpdf/testunoconv | Back to unoconv installation ]]
[[ mod/assign/feedback/editpdf/testunoconv | Back to unoconv installation ]]

Revision as of 01:11, 12 April 2017

Upstart script example for unoconv on ubuntu

Back to unoconv installation

This script can be installed to /etc/init/unoconv.conf and then started with the command:

sudo start unoconv

Here is the script.

# Unoconv listener service

# Install to /etc/init/ folder and start with "sudo service unoconv start"
# This will start a unoconv listener and restart it if it dies. The listener
# will run as the apache user "www-data" and have access to the same files/folders
# as that user.
# The home folder for this listener will point to /tmp/ and any temporary files used by
# libreoffice will be created there.

description     "Unoconv Apache Listener"
author          "Damyon Wiese <damyon@moodle.com>"

start on filesystem or runlevel [2345]
stop on starting rc RUNLEVEL=[016]

respawn
respawn limit 2 5

env HOME=/tmp
setuid www-data

# The default of 5 seconds is too low for mysql which needs to flush buffers

pre-start script
    # Kill any currently running soffice processes.
    /usr/bin/killall soffice.bin || true

    # Service logging when starting
    echo "[`date`] Starting unoconv service" >> /var/log/unoconv.log
end script

script
     # pid file...
    echo $$ > /var/run/unoconv.pid
    exec usr/bin/unoconv --listener
end script

pre-stop script
    # Remove pid file first
    rm /var/run/unoconv.pid
    # Service logging when stopping
    echo "[`date`] Stopping unoconv service" >> /var/log/unoconv.log
end script

Back to unoconv installation