From 2332871fa28e9fc1b1b6cbf27e3123b561072913 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Fri, 26 May 2023 10:28:28 +0200 Subject: [PATCH] migration: execute under the proper user --- scripts/_common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index dce1e80..322f875 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,6 +15,7 @@ mariadb-to-pg() { ynh_print_info --message="Migrating to PostgreSQL database..." + username=$app mysqlpwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) # In old instance db_user is `mmuser` @@ -35,7 +36,7 @@ mariadb-to-pg() { pushd $final_path ynh_systemd_action --service_name="$app" --action="stop" set +e - sudo -u mattermost timeout --preserve-status 300 "./bin/mattermost" + sudo -u "$username" timeout --preserve-status 300 "./bin/mattermost" if [ "$?" != "0" ] && [ "$?" != "143" ] ; then ynh_die --message="Failed to run Mattermost to create PostgreSQL database tables" --ret_code=1 fi