/usr/lib/desktopcouch/desktopcouch-get-port is in desktopcouch 1.0.8-0ubuntu3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #!/usr/bin/python
# Copyright 2010 Canonical Ltd.
#
# This file is part of desktopcouch.
#
# desktopcouch is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# desktopcouch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with desktopcouch. If not, see <http://www.gnu.org/licenses/>.
#
# Authors: Chad Miller <chad.miller@canonical.com>
# Eric Casteleijn <eric.casteleijn@canonical.com>
# Vincenzo Di Somma <vincenzo.di.somma@canonical.com>
"""Return on stdout the port that the personal couchdb is listening on.
As always, success returns a zero exit code, and an exception in Python
returns an exit code of one. On error, stderr should have information
useful for debugging."""
# pylint: disable=C0103
from desktopcouch.application import platform
import sys
import os
DEVNULL = open(os.devnull, "w")
SAVED_STDOUT = sys.stdout
try:
# Don't let any of our output interfere
sys.stdout = DEVNULL
PORT = platform.find_port()
finally:
sys.stdout = SAVED_STDOUT
DEVNULL.close()
print PORT
|