]> git.ipfire.org Git - people/ms/network.git/blame - functions.service
Add support for automatic configuration of radvd.
[people/ms/network.git] / functions.service
CommitLineData
1eec4672
MT
1#!/bin/bash
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2010 Michael Tremer & Christian Schmidt #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22function service_start() {
23 local name=${1}
24 shift
25
26 assert isset name
27
28 systemctl start ${name}.service
29}
30
31function service_stop() {
32 local name=${1}
33 shift
34
35 assert isset name
36
37 systemctl stop ${name}.service
38}
39
40function service_restart() {
41 local name=${1}
42 shift
43
44 assert isset name
45
46 systemctl restart ${name}.service
47}
48
49function service_reload() {
50 local name=${1}
51 shift
52
53 assert isset name
54
55 if service_status ${name}; then
56 systemctl reload ${name}.service
57 return $?
58 else
59 log WARNING "Cannot reload service '${name}' which is currently not running."
60 fi
61}
62
63function service_status() {
64 local name=${1}
65 shift
66
67 assert isset name
68
69 systemctl status ${name}.service >/dev/null 2>&1
70 return $?
71}