Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
slarp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Desplanque
slarp
Commits
9279b059
Commit
9279b059
authored
Jun 26, 2018
by
Paul Desplanque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better container management
parent
10212fe7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
CHANGELOG.md
CHANGELOG.md
+5
-0
is-running
is-running
+6
-3
stop
stop
+13
-5
No files found.
CHANGELOG.md
View file @
9279b059
...
...
@@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
Error in documentation
### Changed
-
is-running is safer to use
-
The stop command always tries to remove the container, whatever is-running says
## [1.2.0] - 2018-04-08
...
...
is-running
View file @
9279b059
...
...
@@ -9,7 +9,10 @@ function say_no {
service docker status &>/dev/null
||
say_no
docker ps |
grep
-q
"
$APP_NAME
$"
[
$?
-eq
0
]
||
say_no
status
=
$(
docker inspect
-f
=
'{{.State.Status}}'
"
$APP_NAME
"
2>/dev/null
)
[
"
$status
"
==
"running"
]
&&
{
echo
"yes"
exit
}
echo
"yes"
say_no
stop
View file @
9279b059
...
...
@@ -3,10 +3,18 @@ SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APP_NAME
=
$(
basename
"
$SELF_DIR
"
)
[
$(
.
"
$SELF_DIR
"
/is-running
)
==
"yes"
]
||
{
echo
"
$APP_NAME
is already stopped"
exit
docker inspect
-f
=
'{{.State.Status}}'
"
$APP_NAME
"
&>/dev/null
[
$?
-ne
0
]
&&
{
echo
"
$APP_NAME
is already stopped"
exit
}
}
docker stop
$APP_NAME
>
/dev/null
&&
\
docker
rm
$APP_NAME
>
/dev/null
&&
\
echo
"
$APP_NAME
stopped"
docker stop
$APP_NAME
>
/dev/null
docker
rm
-f
$APP_NAME
>
/dev/null
&&
{
echo
"
$APP_NAME
stopped"
exit
}
echo
"Error while trying to remove
$APP_NAME
container"
>
&2
exit
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