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