SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
Automation m ysql_and_customer_photo
1. Automating Photo and MySQL backup
Photo backup
Install winSCP whichisusedtotransferfilesfromservertolocal system
Clickon newbutton and enter the detailsas belowlike username and password
2. Clickon save itwill promptyouto with save as popupgive ansuitable name thisname will be used
while writingscript andchecksave passwordcheckbox and clickon okbuttonthis sessionwill be saved
and savedseverwill be displayed
List of Server will be displayedlike below if youclickonloginbyselectinganyof the server’sitwill
automaticallygetsloggedin (onlyif ucheckedsave passwordcheckbox while savingthe server)
3. Nowselectsavedsesstion and clickon login itwill automaticallyauthenticate andgetloggedin
Nowsetupthe file structure as belowand save the sessiongoingforsessiontabandselectingsave
sessionthat’s all youneedtodoin winSCPnow we needtowrite script
Note:the file youwantto transfermustbe displayedlike thisinmycase I’mtransferringcustomerphoto
folder
Writingscript to transfer files
4. /**********Script Starts *************
Optionbatchon
Optionconfirmoff
Open saved sessionname
cd backups
optiontransferbinary
get/customerphoto*roothomeubuntucustomerphoto*
synchronize local D:DropBoxDropboxPortalBackupcustomerphoto customerphoto
/**********Script Ends *************
Copyabove scriptintotextfile andsave itin mycase I have saveditto E:Backupsync.txt
saved sessionname will be savedsession name
roothomeubuntucustomerphoto* folderpathinthe server
D:DropBoxDropboxlBackupcustomerphoto Local systempath
get /customerphoto* Thiswill workas an tempvariable
Schedulinga task inwindows machine to trigger an event
Note : local pathmust be present i.e. ..D:DropBoxDropboxPortalBackupcustomerphoto must
be present
Control panel >system and security> Administrative tools>Task Scheduler
5. Clickon create basic task
Enter name anddescriptionandclickonnext
In nexttabselectintervalstotrigger i.e...dailyorweeklyetcin nexttabsetuptime totrigger
In nexttabselectstarta programand clickon next
In start a program tab clickon browse buttonopen Cdrive >program Files>winSCP>winscp.exe file
In addarguments enterthe script path : /console /script=E:Backupsync.txt /log=E:backuplog.txt
E:Backupsync.txt : isthe pathof the scriptpresent
/log=E:backuplog.txt : path to write the logs
6. Clickon nextand finishit
All list of tasks will be displayedas above u can test it by starting task right click on task and start it
It will start comparing and syncingthe files fromserver to local
7. MySQL backup automation
For takingMySQL backupautomaticallyfirstyouneedtosetupcrone jobinthe serverwhichwill
automatically takesdumpandstoresinserver folderfinallywe needtoruna jobfrom local machine
usingwinSCPandtransferthe file tolocal system
Note:fordoingthiswe needto thinkof time difference isserverandlocal forE.g. if your serverisin
GMT and local isin IST youneedto planaccordinglyandsetup
Daily1:30 PM local time serverwill runacorn joband take a backup(note thisservertime will be
different)
Once corn job iscompletedwe needtostartlocal jobfromFTP and transferthisfile tolocal
Login through SSH
Commends
Mkdir mysqlBackup
Cd mysqlBackup/
Sudonano mysqlBackup.sh
A newfile willbe openedlike this
Enter belowcommand thisthatfile andsave thisfile
mysqldump -uroot-p'PASS' DBNAME | gzip> "../mysqlBackup/backup-$(date).sql.gz"2>
../mysqlBackup/dump.log
8. PASS : is DB pass and root isusername
"../mysqlBackup: thisisthe pathwhere filesmustbe stored
backup-$(date).sql.gz": file name withdate,day,time sothatyou can identifythe files
Note : for savingthisfile youneedsuperuserpermeation
Settingupcorn job
Enter : crontab –e command
List of croneswill be displayed inthe above displaythere are twocronesactive
0 15 * * * /bin/sh/mysqlBackup/mysqlBackup.sh
9. 0 8 * * * /bin/sh/mysqlBackup/mysqlBackup.sh
0 8 * * * and0 15 * * * definestime atwhattime thisjobshouldtriggersthiswilltriggerat8:00 AM and
3:00 PM(Note thisisservertime )
/bin/sh: isthe commandto run .shfiles
/mysqlBackup/mysqlBackup.sh : path ware youhave saved.sh file inmycase I have storedinabove
path
That’s all thisjobswill be triggeredattime specifiedandstoresthe file inthe pathlike this
Nextstepisto transferthisfile tolocal sothat if servergetscrashedbackupwill be presentinlocal
For thisyouneedto followthe stepswe usedtophotobackup
Justchange the scriptlike this
optionbatchon
optionconfirmoff
openMysqlBackup
cd backups
optiontransferbinary
get/mysqlBackup*rootmysqlBackup*
synchronize local D:DropBoxDropboxPortalBackupMySqlDumpmysqlBackup
exit
10. MysqlBackup: thisis sessionname storedwithpasswordonce openedfolders displayedmustbe like
this
mysqlBackup folder mustbe displayedif notsetitupby savingthe sessiononce thisisdone setupand
task inlocal machine bygivingpathof the scriptas above and setupthe time fortestingucan start that
task youwill getbelowoutput