LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-15-2008, 02:32 AM   #1
mts7
LQ Newbie
 
Registered: Mar 2008
Distribution: CentOS 4.5
Posts: 12

Rep: Reputation: 0
Question Mark appended to the end of file names


I'm not sure if this is the right place for this thread, but here it is.

I do a database backup through the shell and write the dump to a file, but the file names end up looking like db1.sql?, db2.sql?, db3.sql. :'( When I include the proper files names in a cron job for tar (doing a site backup), the tar doesn't complete because it can't find those files.

Why are there question marks at the ends of the file names?

How can I get my script to not generate or fix the question marks?

code inside my sh file...
mysqldump -uuser_name 4 -ppassword --opt db1 > /home/user/logs/db1.sql
mysqldump -uuser_name 4 -ppassword --opt db2 > /home/user/logs/db2.sql
mysqldump -uuser_name 4 -ppassword --opt db3 > /home/user/logs/db3.sql

The cron job executes a php script that executes that shell script and then executes the tar.

Any help would be greatly appreciated. Thanks. :-D

mts
 
Old 09-15-2008, 03:32 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,735

Rep: Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523
How did you create the shell file? Was it on an MS box?
There should be a space between -u and username value. What is the '4' doing there?
 
Old 09-15-2008, 11:56 AM   #3
mts7
LQ Newbie
 
Registered: Mar 2008
Distribution: CentOS 4.5
Posts: 12

Original Poster
Rep: Reputation: 0
Yes, I created it on Windows. I actually copied the script from somewhere on the Internet. It works great with just one file. The 4 was leftover from my user name... I forgot to get rid of that part, too. I changed the script to have a space between the user name and password flags and values. Do these things have to do with the question marks?
 
Old 09-15-2008, 08:57 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,735

Rep: Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523
MS uses a different line-ending sequence (\r\n) to Unix/Linux (\n). This causes issues.
You can use the (Unix) util dos2unix to convert the file.

Here's the doc for mysqldump.
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

Note that usually there is a space between the flag and the value eg -u username, but -p is an exception, there should be no space, thus: -ppasswd
See the link I gave you.

HTH
PS Please add your distro to your profile so we can see it, and post the ver of MySQL as well.
 
Old 09-18-2008, 03:51 AM   #5
mts7
LQ Newbie
 
Registered: Mar 2008
Distribution: CentOS 4.5
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for the quick response. :-) I added the dos2unix program to my script and it seems to be working the way I expect. Thanks. :-D I have dos2unix in the script in case I change the sh file on my Windows box.

I changed the mysqldump stuff like you mentioned and was listed in the manual. I think it was the \r\n stuff that was appending ? to all of the sql files. Adding that program call seemed to work just fine.

mysql 5.0.51a is the version installed on the server.

Thanks again for the help!

MTS
 
Old 09-18-2008, 08:41 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,735

Rep: Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523
My recommendation, edit Linux files on Linux, MS files on MS.


Saves on the ftp/scp as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Availigent Names StrataFusion's Mark Egan to Board of Directors LXer Syndicated Linux News 0 06-17-2007 09:31 AM
Including a file with a question mark in it breaks my php ayteebee Programming 6 11-16-2006 04:22 PM
file accidentally appended to itself, how to separate? sqrt7744 Linux - General 5 04-29-2006 03:30 PM
Wierd String appended to end of line lel800 General 8 12-28-2004 03:55 PM
vim: mark end-of-line? trim blank lines? prell Linux - Software 3 09-20-2004 11:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration