Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Glpi
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
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
NoCloud
docker
Glpi
Commits
04658160
Verified
Commit
04658160
authored
2 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
CLI
parent
e8628bbb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
glpi
+85
-0
85 additions, 0 deletions
glpi
with
85 additions
and
0 deletions
glpi
0 → 100755
+
85
−
0
View file @
04658160
#!/bin/bash
is_docker
()
{
if
[
!
-z
"
$(
which docker-compose 2>/dev/null
)
"
]
;
then
echo
"1"
else
echo
"0"
fi
}
usage
()
{
echo
-e
"Usage
$0
<command> [args]
\n
"
echo
-e
"COMMANDS
\n
"
echo
"bash"
echo
-e
"
\t
opens a bash terminal in front container or just run bash"
echo
"cache"
echo
-e
"
\t
clears all the caches and update assets_hashes"
echo
"console"
echo
-e
"
\t
run artisan, argument are passed to artisan"
echo
"down"
echo
-e
"
\t
stops the docker stack"
echo
"help"
echo
-e
"
\t
displays this messages and exit"
echo
"mysql"
echo
-e
"
\t
open a mysql prompt in LNB database"
echo
"restart"
echo
-e
"
\t
restart the docker stack or apache2"
echo
"up"
echo
-e
"
\t
starts the stack"
}
if
[
"
$(
is_docker
)
"
-eq
1
]
;
then
cmd
=
"docker-compose exec glpi"
cmdmy
=
"docker-compose exec db"
cmdmyInput
=
"docker exec -i
$(
docker-compose ps
-q
db
)
"
cmdrestart
=
"docker-compose restart"
cmdup
=
"docker-compose up"
cmddown
=
"docker-compose down"
else
cmdrestart
=
"apache2ctl restart"
fi
user
=
$(
awk
-F
'='
'/MYSQL_USER/{print $2}'
.env
)
db
=
$(
awk
-F
'='
'/MYSQL_DATABASE/{print $2}'
.env
)
pass
=
$(
awk
-F
'='
'/MYSQL_PASSWORD/{print $2}'
.env
)
mysql
=
"mysql -u
$user
$db
-p
$pass
"
DIR
=
"
$(
dirname
$0
)
"
action
=
$1
shift
# Keep actions sorted
case
$action
in
"bash"
)
$cmd
bash
;;
"cache"
)
$0
console cache:clear
;;
"console"
)
$cmd
php bin/console
$@
;;
"down"
)
$cmddown
;;
"help"
)
usage
;;
"mysql"
)
$cmdmy
$mysql
;;
"restart"
)
$cmdrestart
$@
;;
"up"
)
$cmdup
$@
;;
*
)
echo
"ERROR: No command given"
usage
exit
1
;;
esac
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