Consectatio Excellentiae

Recently we have been setting backups of MySql databases to be ran using Crontab, for all of the systems and sites we migrated to our new servers. Whilst carrying out the task in hand the strangest problem was encountered.

The mundane process of resaving the file to the relevant set of files with the new connection details, upload the file apply the correct permissions to the folder as well as the bash file. Then login via PUTTY and configure Crontab to execute the list of new bash files that were uploaded. This all worked fine, apart from the step where I uploaded the files, by mistake I created a file for an already existing website, and uploaded it over the already existing file, however thought nothing of this.

I then decided to run the bash files via the terminal to ensure they all worked correctly, and miraculously they all appeared fine. Then out of boredom I thought ‘ah well I did upload a new one over the old one, so I will just check…’  I must say I was fortunate that I checked this file as the result was catastrophic!

The script that has previously worked for the last three months decided to STOP! But there was no error, the file was creating, the file size appeared correct but there was no extension (.sql.gz) assigned to the file. After hours of searching the internet I decided to give Stackoverflow and LinuxQuestions a go. After a bit of ‘friendly’ criticism that my question was ridiculous the answer was stumbled upon on both platforms almost within minutes of each other. I was informed to use dos2unix command on the file whilst logged into the terminal and Boom the problem was fixed! As simple as that I am not a bash coder or Linux user so there was no way on earth I would have resolved that one by myself!

Leave a Reply