Restart gogs after restore
This commit is contained in:
parent
282d45cd64
commit
3f5a1bfdd8
|
@ -261,15 +261,22 @@ function restore_local_gogs {
|
||||||
function_check gogs_create_database
|
function_check gogs_create_database
|
||||||
gogs_create_database
|
gogs_create_database
|
||||||
|
|
||||||
|
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||||
|
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||||
|
|
||||||
function_check restore_database
|
function_check restore_database
|
||||||
restore_database gogs ${GIT_DOMAIN_NAME}
|
restore_database gogs ${GIT_DOMAIN_NAME}
|
||||||
temp_restore_dir=/root/tempgogs
|
temp_restore_dir=/root/tempgogs
|
||||||
if [ -d ${USB_MOUNT}/backup/gogs ]; then
|
if [ -d ${USB_MOUNT}/backup/gogs ]; then
|
||||||
echo $"Restoring Gogs settings"
|
echo $"Restoring Gogs settings"
|
||||||
if [ ! -d /home/${GOGS_USERNAME}/custom/conf ]; then
|
if [ ! -d $GOGS_CONFIG_PATH ]; then
|
||||||
mkdir -p /home/${GOGS_USERNAME}/custom/conf
|
mkdir -p $GOGS_CONFIG_PATH
|
||||||
|
fi
|
||||||
|
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
||||||
|
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
||||||
|
else
|
||||||
|
cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
|
||||||
fi
|
fi
|
||||||
cp -r ${temp_restore_dir}/conf/* /home/${GOGS_USERNAME}/custom/conf/
|
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
function_check set_user_permissions
|
function_check set_user_permissions
|
||||||
set_user_permissions
|
set_user_permissions
|
||||||
|
@ -319,11 +326,10 @@ function restore_local_gogs {
|
||||||
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
|
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
|
||||||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
|
||||||
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
||||||
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
||||||
MARIADB_PASSWORD=
|
MARIADB_PASSWORD=
|
||||||
|
systemctl restart gogs
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,11 +369,14 @@ function restore_remote_gogs {
|
||||||
function_check gogs_create_database
|
function_check gogs_create_database
|
||||||
gogs_create_database
|
gogs_create_database
|
||||||
|
|
||||||
|
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
||||||
|
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||||
|
|
||||||
function_check restore_database_from_friend
|
function_check restore_database_from_friend
|
||||||
restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
|
restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
|
||||||
if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
|
if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
|
||||||
if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
|
if [ ! -d $GOGS_CONFIG_PATH ]; then
|
||||||
mkdir -p /home/${GOGS_USERNAME}/custom
|
mkdir -p $GOGS_CONFIG_PATH
|
||||||
fi
|
fi
|
||||||
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
||||||
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
||||||
|
@ -410,11 +419,10 @@ function restore_remote_gogs {
|
||||||
echo $"Restore of Gogs complete"
|
echo $"Restore of Gogs complete"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
|
||||||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
|
||||||
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
||||||
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
||||||
MARIADB_PASSWORD=
|
MARIADB_PASSWORD=
|
||||||
|
systemctl restart gogs
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue