Skip to content
Snippets Groups Projects
Verified Commit f2d35ff4 authored by David Beniamine's avatar David Beniamine
Browse files

Improve doli, add logs and get_conf_var

parent a08a41f8
Branches
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
get_conf_val () {
grep $1 dolibarr_src/htdocs/conf/conf.php | cut -d '=' -f 2 | sed -e "s/^'//" -e "s/';$//"
}
APP_SERVICE="dolibarr" APP_SERVICE="dolibarr"
DB_SERVICE="mariadb" DB_SERVICE="mariadb"
user=$APP_SERVICE user=$(get_conf_val main_db_user)
db=$APP_SERVICE db=$(get_conf_val main_db_name)
PASS_VARIABLE="PASS" PASS_VARIABLE="PASS"
DUMP_PATH="dumps/internal.sql.gz" DUMP_PATH="dumps/internal.sql.gz"
document_path=$(get_conf_val main_data_root)
is_docker() { is_docker() {
if [ ! -z "$(which docker-compose 2>/dev/null)" ]; if [ ! -z "$(which docker-compose 2>/dev/null)" ];
...@@ -25,6 +30,8 @@ usage() { ...@@ -25,6 +30,8 @@ usage() {
echo -e "\t stops the docker stack" echo -e "\t stops the docker stack"
echo "help" echo "help"
echo -e "\t displays this messages and exit" echo -e "\t displays this messages and exit"
echo "logs"
echo -e "\t Follow all usefull logs"
echo "mysql" echo "mysql"
echo -e "\topen a mysql prompt in LNB database" echo -e "\topen a mysql prompt in LNB database"
echo "mysql_dump" echo "mysql_dump"
...@@ -56,7 +63,7 @@ else ...@@ -56,7 +63,7 @@ else
cmdrestart="apache2ctl restart" cmdrestart="apache2ctl restart"
fi fi
pass=$(awk -F '=' '/PASS/{print $2}' .env) pass=$(get_conf_val main_db_pass)
mysql="mariadb -u $user $db -p$pass" mysql="mariadb -u $user $db -p$pass"
DIR="$(dirname $0)" DIR="$(dirname $0)"
...@@ -73,6 +80,17 @@ case $action in ...@@ -73,6 +80,17 @@ case $action in
"help") "help")
usage usage
;; ;;
"logs")
set -x
$cmd tail -f $document_path/dolibarr.log \
$document_path/dolibarr_payment.log \
$document_path/dolibarr_cron.log \
$document_path/cron_run_jobs.php.log \
$document_path/dolibarr.log \
/var/log/apache2/access.log
/var/log/apache2/error.log
set +x
;;
"mysql") "mysql")
set -x set -x
$cmdmy $mysql $cmdmy $mysql
...@@ -112,10 +130,11 @@ case $action in ...@@ -112,10 +130,11 @@ case $action in
esac esac
;; ;;
"perms") "perms")
$cmd chown -R $(id -u):33 dolibarr/ $cmd chown -R $(id -u):33 dolibarr_src/
$cmd chmod -R g+w dolibarr/documents $cmd chown -R $(id -u):33 $document_path
$cmd chmod -R g-w dolibarr/htdocs $cmd chmod -R g+w $document_path
$cmd touch dolibarr/documents/install.lock $cmd chmod -R g-w dolibarr_src/htdocs
$cmd touch $document_path/install.lock
;; ;;
"restart") "restart")
$cmdrestart $@ $cmdrestart $@
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment