components/openstack/horizon/files/horizon
changeset 6856 356aeea98c39
equal deleted inserted replaced
6855:ea44e7e0ca98 6856:356aeea98c39
       
     1 #!/usr/bin/python2.7
       
     2 
       
     3 # Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
       
     4 #
       
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
       
     6 #    not use this file except in compliance with the License. You may obtain
       
     7 #    a copy of the License at
       
     8 #
       
     9 #         http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 #    Unless required by applicable law or agreed to in writing, software
       
    12 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
       
    13 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
       
    14 #    License for the specific language governing permissions and limitations
       
    15 #    under the License.
       
    16 
       
    17 import os
       
    18 from subprocess import CalledProcessError, check_call, Popen
       
    19 import sys
       
    20 
       
    21 import smf_include
       
    22 
       
    23 
       
    24 def httpd(cmd):
       
    25     cmd = ['/usr/apache2/2.4/bin/httpd', '-f',
       
    26            '/var/lib/openstack_dashboard/openstack_dashboard.httpd.conf',
       
    27            '-k', cmd]
       
    28     try:
       
    29         Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
       
    30     except CalledProcessError as err:
       
    31         print >> sys.stderr, 'Error executing %s: %s' % (cmd, err)
       
    32         sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
       
    33 
       
    34     sys.exit(smf_include.SMF_EXIT_OK)
       
    35 
       
    36 
       
    37 def start():
       
    38     httpd('start')
       
    39 
       
    40 
       
    41 def stop():
       
    42     httpd('stop')
       
    43 
       
    44 
       
    45 def restart():
       
    46     httpd('restart')
       
    47 
       
    48 
       
    49 if __name__ == '__main__':
       
    50     os.putenv('LC_ALL', 'C')
       
    51     smf_include.smf_main()