mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
migration: execute under the proper user
This commit is contained in:
parent
fb3aed0add
commit
2332871fa2
1 changed files with 2 additions and 1 deletions
|
@ -15,6 +15,7 @@ mariadb-to-pg() {
|
||||||
|
|
||||||
ynh_print_info --message="Migrating to PostgreSQL database..."
|
ynh_print_info --message="Migrating to PostgreSQL database..."
|
||||||
|
|
||||||
|
username=$app
|
||||||
mysqlpwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
mysqlpwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
|
||||||
# In old instance db_user is `mmuser`
|
# In old instance db_user is `mmuser`
|
||||||
|
@ -35,7 +36,7 @@ mariadb-to-pg() {
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_systemd_action --service_name="$app" --action="stop"
|
ynh_systemd_action --service_name="$app" --action="stop"
|
||||||
set +e
|
set +e
|
||||||
sudo -u mattermost timeout --preserve-status 300 "./bin/mattermost"
|
sudo -u "$username" timeout --preserve-status 300 "./bin/mattermost"
|
||||||
if [ "$?" != "0" ] && [ "$?" != "143" ] ; then
|
if [ "$?" != "0" ] && [ "$?" != "143" ] ; then
|
||||||
ynh_die --message="Failed to run Mattermost to create PostgreSQL database tables" --ret_code=1
|
ynh_die --message="Failed to run Mattermost to create PostgreSQL database tables" --ret_code=1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue