1

Possible Duplicate:
Bash/Korn shell script edited on Windows throws error ‘…^M: not found’

I'm writting an Upstart job to run Postgresql:

description "PostgreSQL 9.1 Server"
author "PostgreSQL"

start on runlevel [2345]
stop on runlevel [016]
respawn
pre-start script
    if [ -d /var/run/postgresql ]; then
        chmod 2775 /var/run/postgresql
    else
        install -d -m 2775 -o postgres -g postgres /var/run/postgresql
    fi
end script
exec su -c "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" postgres

If I run separate command directly from shell, they work fine. However, if they are run through Upstart... the folder gets named /var/run/postgresql?.

Note the question mark at the end. Why does it occur??

U2ros
  • 245
  • 3
  • 8
  • 2
    Any chance your file has wrong line-endings (Windows or Mac)? – Mat Dec 09 '12 at 15:55
  • I just solved my problem by hand typing the file on the server itself. I did not know it was such an issue uploading ascii files from windows to linux, now i do ;) – U2ros Dec 09 '12 at 16:04
  • 1
    Here's a related question with the "usual" result of that (i.e. command not found errors): http://unix.stackexchange.com/questions/56024/bash-korn-shell-script-edited-on-windows-throws-error-m-not-found Contains ways to fix it other than just re-typing the while thing :) – Mat Dec 09 '12 at 16:07
  • You means `ls` shows a `?`, right? That `?` actually stands for an unprintable character, to wit, a carriage return (CR, ^M). See [Bash/Korn shell script edited on Windows throws error '...^M: not found'](http://unix.stackexchange.com/q/56024) for the rest of the story. – Gilles 'SO- stop being evil' Dec 09 '12 at 23:00

0 Answers0