Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
6df9738b
Commit
6df9738b
authored
Sep 01, 2021
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serv: separate enable/disable and on/off
parent
8f82819f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
18 deletions
+76
-18
serv
bin/serv
+9
-3
serv-disable
bin/serv-disable
+2
-3
serv-enable
bin/serv-enable
+3
-12
serv-off
bin/serv-off
+32
-0
serv-on
bin/serv-on
+30
-0
No files found.
bin/serv
View file @
6df9738b
...
...
@@ -132,7 +132,7 @@ print_version()
[
"
$virt
"
=
"(unknown)"
]
||
[
"
$virt
"
=
"(host system)"
]
||
on_text
=
"(under
$virt
)"
echo
"Service manager version @VERSION@ https://wiki.etersoft.ru/Epm"
echo
"Running on
$(
$DISTRVENDOR
-e
)
$on_text
with
$SERVICETYPE
"
echo
"Copyright (c) Etersoft 2012-20
19
"
echo
"Copyright (c) Etersoft 2012-20
21
"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
}
...
...
@@ -176,10 +176,16 @@ check_command()
stop
)
# HELPCMD: stop service
serv_cmd
=
stop
;;
on|enable
)
# HELPCMD: add service to run on startup and start it now
on
)
# HELPCMD: add service to run on startup and start it now
serv_cmd
=
on
;;
off
)
# HELPCMD: remove service to run on startup and stop it now
serv_cmd
=
off
;;
enable
)
# HELPCMD: add service to run on startup (see 'on' also)
serv_cmd
=
enable
;;
off|disable
)
# HELPCMD: remove service to run on startup and stop it now
disable
)
# HELPCMD: remove service to run on startup (see 'off' also)
serv_cmd
=
disable
;;
log|journal
)
# HELPCMD: print log for the service (-f - follow, -r - reverse order)
...
...
bin/serv-disable
View file @
6df9738b
#!/bin/sh
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016
, 2021
Etersoft
# Copyright (C) 2012, 2016
, 2021
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
...
...
@@ -25,7 +25,6 @@ serv_disable()
{
local
SERVICE
=
"
$1
"
is_service_running
$1
&&
{
serv_stop
$1
||
return
;
}
is_service_autostart
$1
||
{
info
"Service
$1
already disabled for startup"
&&
return
;
}
case
$SERVICETYPE
in
...
...
bin/serv-enable
View file @
6df9738b
#!/bin/sh
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016
, 2021
Etersoft
# Copyright (C) 2012, 2016
, 2021
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
...
...
@@ -21,7 +21,7 @@ load_helper serv-start
load_helper serv-status
# Enable service by default
__
serv_enable
()
serv_enable
()
{
local
SERVICE
=
"
$1
"
...
...
@@ -58,13 +58,4 @@ __serv_enable()
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
esac
}
serv_enable
()
{
__serv_enable
"
$1
"
||
return
# start if need
is_service_running
$1
&&
info
"Service
$1
is already running"
&&
return
serv_start
$1
}
bin/serv-off
0 → 100644
View file @
6df9738b
#!/bin/sh
#
# Copyright (C) 2012, 2016, 2021 Etersoft
# Copyright (C) 2012, 2016, 2021 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/>.
#
load_helper serv-stop
load_helper serv-disable
load_helper serv-status
# Enable service by default
serv_off
()
{
local
SERVICE
=
"
$1
"
is_service_running
$1
&&
{
serv_stop
$1
||
return
;
}
is_service_autostart
$1
||
{
info
"Service
$1
already disabled for startup"
&&
return
;
}
serv_disable
$SERVICE
}
bin/serv-on
0 → 100644
View file @
6df9738b
#!/bin/sh
#
# Copyright (C) 2012, 2016, 2021 Etersoft
# Copyright (C) 2012, 2016, 2021 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/>.
#
load_helper serv-start
load_helper serv-enable
load_helper serv-status
serv_on
()
{
serv_enable
"
$1
"
||
return
# start if need
is_service_running
$1
&&
info
"Service
$1
is already running"
&&
return
serv_start
$1
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment