Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Vidal
66
Commits
e46e2f84
Commit
e46e2f84
authored
2 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
do not start a service not already running
parent
df60d2f3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib66/exec/ssexec_reconfigure.c
+13
-6
13 additions, 6 deletions
src/lib66/exec/ssexec_reconfigure.c
with
13 additions
and
6 deletions
src/lib66/exec/ssexec_reconfigure.c
+
13
−
6
View file @
e46e2f84
...
...
@@ -17,6 +17,7 @@
#include
<oblibs/log.h>
#include
<oblibs/types.h>
#include
<oblibs/graph.h>
#include
<oblibs/sastr.h>
#include
<skalibs/sgetopt.h>
...
...
@@ -27,6 +28,7 @@
#include
<66/svc.h>
#include
<66/sanitize.h>
#include
<66/service.h>
#include
<66/constants.h>
#include
<stdio.h>
...
...
@@ -38,12 +40,13 @@ int ssexec_reconfigure(int argc, char const *const *argv, ssexec_t *info)
uint32_t
flag
=
0
;
uint8_t
siglen
=
0
;
graph_t
graph
=
GRAPH_ZERO
;
stralloc
sa
=
STRALLOC_ZERO
;
unsigned
int
areslen
=
0
,
list
[
SS_MAX_SERVICE
],
visit
[
SS_MAX_SERVICE
],
nservice
=
0
,
n
=
0
;
resolve_service_t
ares
[
SS_MAX_SERVICE
]
;
char
atree
[
SS_MAX_TREENAME
+
1
]
;
FLAGS_SET
(
flag
,
STATE_FLAGS_TOPROPAGATE
|
STATE_FLAGS_TO
INIT
|
STATE_FLAGS_WANTUP
)
;
FLAGS_SET
(
flag
,
STATE_FLAGS_TOPROPAGATE
|
STATE_FLAGS_TO
PARSE
|
STATE_FLAGS_WANTUP
)
;
{
subgetopt
l
=
SUBGETOPT_ZERO
;
...
...
@@ -87,7 +90,7 @@ int ssexec_reconfigure(int argc, char const *const *argv, ssexec_t *info)
if
(
!
r
)
{
/** nothing to do */
log_warn
(
argv
[
n
],
" is not parsed -- try to
start
it first"
)
;
log_warn
(
argv
[
n
],
" is not parsed -- try to
parse
it first"
)
;
return
0
;
}
...
...
@@ -135,6 +138,10 @@ int ssexec_reconfigure(int argc, char const *const *argv, ssexec_t *info)
}
}
}
/** keep list of already running service */
char
const
*
exclude
[
4
]
=
{
SS_FDHOLDER
,
SS_ONESHOTD
,
SS_SVSCAN_LOG
,
0
}
;
if
(
!
sastr_dir_get
(
&
sa
,
info
->
scandir
.
s
,
exclude
,
S_IFDIR
))
log_dieusys
(
LOG_EXIT_SYS
,
"get list of running services"
)
;
{
/** stop service and unsupervise it */
...
...
@@ -163,7 +170,6 @@ int ssexec_reconfigure(int argc, char const *const *argv, ssexec_t *info)
{
/** start service */
unsigned
int
m
=
0
;
int
nargc
=
1
+
nservice
+
siglen
;
char
const
*
newargv
[
nargc
]
;
newargv
[
m
++
]
=
"start"
;
...
...
@@ -172,17 +178,18 @@ int ssexec_reconfigure(int argc, char const *const *argv, ssexec_t *info)
for
(
n
=
0
;
n
<
nservice
;
n
++
)
{
char
*
name
=
graph
.
data
.
s
+
genalloc_s
(
graph_hash_t
,
&
graph
.
hash
)[
list
[
n
]].
vertex
;
newargv
[
m
++
]
=
name
;
if
(
sastr_cmp
(
&
sa
,
name
)
>=
0
)
newargv
[
m
++
]
=
name
;
}
newargv
[
m
++
]
=
0
;
e
=
ssexec_start
(
nargc
,
newargv
,
info
)
;
e
=
ssexec_start
(
m
-
1
,
newargv
,
info
)
;
}
freed:
stralloc_free
(
&
sa
)
;
service_resolve_array_free
(
ares
,
areslen
)
;
graph_free_all
(
&
graph
)
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment