lib/pvl/service.sh
changeset 730 2073e2e20895
parent 711 36b87b9e6af4
equal deleted inserted replaced
729:5642bd98b0de 730:2073e2e20895
     1 SERVICE_NOOP=
     1 SERVICE_NOOP=
     2 SERVICE_TYPE=
     2 SERVICE_TYPE=
       
     3 
       
     4 SERVICE_SBIN=/usr/sbin/service
     3 
     5 
     4 function service_opt {
     6 function service_opt {
     5     local opt=$1
     7     local opt=$1
     6     local optarg="$2"
     8     local optarg="$2"
     7 
     9 
    26 function service_status {
    28 function service_status {
    27     local service=$1
    29     local service=$1
    28     
    30     
    29     # native upstart services don't exit with any status, but sysvinit compatibility ones do
    31     # native upstart services don't exit with any status, but sysvinit compatibility ones do
    30     if [ $SERVICE_TYPE = upstart -a -e /etc/init/$service.conf ]; then
    32     if [ $SERVICE_TYPE = upstart -a -e /etc/init/$service.conf ]; then
    31         cmd_test service $service status | grep -q start
    33         cmd_test $SERVICE_SBIN $service status | grep -q start
    32     else
    34     else
    33         cmd_test service $service status > /dev/null
    35         cmd_test $SERVICE_SBIN $service status > /dev/null
    34     fi
    36     fi
    35 }
    37 }
    36 
    38 
    37 function service_restart {
    39 function service_restart {
    38     local service=$1
    40     local service=$1
    39     
    41     
    40     cmd_sudo service $service restart
    42     cmd_sudo $SERVICE_SBIN $service restart
    41 }
    43 }
    42 
    44 
    43 function service_reload {
    45 function service_reload {
    44     local service=$1
    46     local service=$1
    45     
    47     
    46     cmd_sudo service $service reload
    48     cmd_sudo $SERVICE_SBIN $service reload
    47 }
    49 }