Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

The script does not stop executing

yadamenko August 5, 2024

 

- step: &restoreDefaultDatabase
name: 'Deploy to Environment'
script:
- pipe: atlassian/ssh-run:0.8.0
variables:
SSH_USER: $REMOTE_SERVER_USER
SERVER: $REMOTE_SERVER_HOST
MODE: 'command'
COMMAND: |
export MYSQL_PWD="$DB_PASSWD" &&
echo "DROP DATABASE" &&
mysql -u$DB_USER -e "DROP DATABASE IF EXISTS $DB_NAME;" &&
echo "CREATE DATABASE" &&
mysql -u$DB_USER -e "CREATE DATABASE IF NOT EXISTS $DB_NAME DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" &&
echo "IMPORT DATABASE" &&
mysql -u$DB_USER -e "SET foreign_key_checks = 0;" &&
mysql --force -u$DB_USER $DB_NAME < /home/qwe/backup/qwe_database.sql > /home/qwe/staging3/backup_import.log 2>&1 || true &&
mysql -u$DB_USER -e "SET foreign_key_checks = 1;" &&
cat /home/qwe/staging3/backup_import.log
artifacts:
- /home/qwe/staging3/backup_import.log

 

This is my script I do a database import into mysql. It takes about 10-15 minutes. I can see that the import is done from phpMyAdmin But this step keeps running without stopping.

keep runing on this line

 

mysql --force -u$DB_USER $DB_NAME < /home/qwe/backup/grayfish_database.sql > /home/qwe/staging3/backup_import.log 2>&1 || true &&

1 answer

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2024

Hi @yadamenko and welcome to the community!

The mysql command that is stuck may not be returning an exit code. I see that you are redirecting output to a log file on that server; you can check that file for indications on what the command is doing.

I also suggest checking if this works outside of Pipelines, to narrow down whether this is a Pipelines specific issue or not. If you have SSH access to this server from your computer, you can connect to that server via SSH and execute the whole command you are running from Pipelines.

Another thing to check would be from Pipelines, but without the pipe. You can install an SSH client during that step (if one is not already present in that step's Docker image) and then use an SSH command to connect to your server and run the command you are running with the pipe.

Kind regards,
Theodora

yadamenko August 7, 2024

Hi @Theodora Boudale, thanks for the answer.
I have already solved this problem with an SSH connection. Where everything works as I expect it to.
In the pip documentation, it was just written that if you have any problems you can post here.

Like Oleksandr Kyrdan likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 9, 2024

Hi,

Thank you for your reply, it's good to hear that you have already solved this.

Can you please confirm, does your solution concern running this command with an SSH command without the pipe? Does the issue occur with the pipe only and not occur when you use an SSH command to connect to your server?

Kind regards,
Theodora

Like yadamenko likes this
yadamenko August 9, 2024

Yep, 
The problem with database immortization occurs only when using pipe, if you do the same procedure via SSH - everything works.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events