~thisfred/desktopcouch/the-great-split-of-2010

« back to all changes in this revision

Viewing changes to desktopcouch/stop_local_couchdb.py

  • Committer: Elliot Murphy
  • Date: 2009-07-08 17:48:11 UTC
  • Revision ID: elliot@canonical.com-20090708174811-zfcdtoq8f71djgcd
Initial release, under LGPLv3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# Copyright 2009 Canonical Ltd.
 
3
#
 
4
# This file is part of desktopcouch.
 
5
#
 
6
#  desktopcouch is free software: you can redistribute it and/or modify
 
7
# it under the terms of the GNU Lesser General Public License version 3
 
8
# as published by the Free Software Foundation.
 
9
#
 
10
# desktopcouch is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU Lesser General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU Lesser General Public License
 
16
# along with desktopcouch.  If not, see <http://www.gnu.org/licenses/>.
 
17
#
 
18
# Author: Stuart Langridge <stuart.langridge@canonical.com>
 
19
"""
 
20
Stop local CouchDB server.
 
21
"""
 
22
import subprocess, sys
 
23
import local_files
 
24
 
 
25
local_exec = local_files.COUCH_EXEC_COMMAND + ["-k"]
 
26
try:
 
27
    retcode = subprocess.call(local_exec, shell=False)
 
28
    if retcode < 0:
 
29
        print >> sys.stderr, "Child was terminated by signal", -retcode
 
30
    elif retcode > 0:
 
31
        print >> sys.stderr, "Child returned", retcode
 
32
except OSError, e:
 
33
    print >> sys.stderr, "Execution failed: %s: %s" % (e, local_exec)
 
34
    exit(1)
 
35
 
 
36