serv-usage 1.5 KB
Newer Older
Vitaly Lipatov's avatar
Vitaly Lipatov committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/sh
#
# Copyright (C) 2012  Etersoft
# Copyright (C) 2012  Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

20 21
_print_additional_usage()
{
22
    echo "serv addition usage: {on|off|try-restart|usage}"
23 24
}

Vitaly Lipatov's avatar
Vitaly Lipatov committed
25 26 27
# Print usage of the service
serv_usage()
{
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
    local SERVICE="$1"
    shift
    case $SERVICETYPE in
        service-chkconfig|service-upstart)
            # CHECKME: many services print out usage in stderr, it conflicts with printout command
            #sudocmd service $SERVICE 2>&1
            sudorun service $SERVICE 2>&1
            ;;
        service-initd|service-update)
            #sudocmd /etc/init.d/$SERVICE 2>&1
            sudorun service $SERVICE 2>&1
            ;;
        systemd)
            sudocmd systemctl $SERVICE 2>&1
            ;;
        *)
            fatal "Have no suitable command for $SERVICETYPE"
            ;;
    esac
Vitaly Lipatov's avatar
Vitaly Lipatov committed
47

48 49
_print_additional_usage

Vitaly Lipatov's avatar
Vitaly Lipatov committed
50
}