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
Nurlan
eepm
Commits
fd99030f
Commit
fd99030f
authored
Dec 07, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serv status: improve running state detection
parent
04bc80ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
serv-status
bin/serv-status
+10
-6
No files found.
bin/serv-status
View file @
fd99030f
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012, 2013, 2016 Etersoft
# Copyright (C) 2012, 2013, 2016
, 2017
Etersoft
# Copyright (C) 2012, 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016
, 2017
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# 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
# it under the terms of the GNU Affero General Public License as published by
...
@@ -21,14 +21,18 @@
...
@@ -21,14 +21,18 @@
is_service_running
()
is_service_running
()
{
{
local
SERVICE
=
"
$1
"
local
SERVICE
=
"
$1
"
local
OUTPUT
# TODO: real status can be checked only with grep output
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
service-chkconfig|service-upstart
)
if
is_anyservice
$1
;
then
if
is_anyservice
$1
;
then
$SUDO
anyservice
$1
status
>
/dev/null 2>/dev/null
OUTPUT
=
"
$(
$SUDO
anyservice
$1
status 2>/dev/null
)
"
||
return
1
return
echo
"
$OUTPUT
"
|
grep
-q
"is stopped"
&&
return
1
return
0
fi
fi
$SUDO
service
$1
status
>
/dev/null 2>/dev/null
OUTPUT
=
"
$(
$SUDO
service
$1
status 2>/dev/null
)
"
||
return
1
echo
"
$OUTPUT
"
|
grep
-q
"is stopped"
&&
return
1
return
0
;;
;;
service-initd|service-update
)
service-initd|service-update
)
$SUDO
$INITDIR
/
$1
status
>
/dev/null 2>/dev/null
$SUDO
$INITDIR
/
$1
status
>
/dev/null 2>/dev/null
...
...
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