Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,
I'm looking for help to design a bash script to locally backup a MySQL database and copy it to a network share.
Ideally a retention option of X day(s) would be welcome.
I have no knowledge of computer language.
Your help is sincerely welcome.
Thank you for your help.

What I have tried:

I tried a local dump using the command :
mysqldump -u root -p glpidatabase > dump-glpi-$(date '+%Y-%m-%d').sql
The database dump is operational.
In parallel, I have mounted the network share in /etc/fstab :
//SERVEUR/FOLDER_GLPI /mnt/FOLDER_GLPI cifs username=USER_NETWORK_SHARE,password=PASSWORD_NETWORKSHARE,uid=USER_ACCOUNT_LINUX,gid=GROUP_ACCOUNT_LINUX
Posted
Updated 15-Apr-24 6:02am
v2

This isn't a "code to order" website - I suggest that if you can't do it for yourself (and are unwilling to learn how) you try somewhere like Freelancer.com - but be aware: you get what you pay for. Pay peanuts, get monkeys.
 
Share this answer
 
This is the type of question that you could probably get answered using something like ChatGPT or Google Gemini. You have the information you want in your question, so what you need to do is write a prompt that will give you a suitable answer. For instance, you could use something like this as your prompt
llm
I want to create a bash script to create a local copy of my MySQL database. Once the backup is created, the script will upload it to a network share. The backup needs to be retained for 7 days, after which point it will be removed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900