Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

AEM on Linux CentOS as service

Avatar

Level 4

Hi,

I have been trying to startup AEM as service on Linux CentOS machine by going through this article https://helpx.adobe.com/experience-manager/kb/linux-init-script.html , when I am trying to start the script using 'sh aemscript.sh' I am getting this error line 17: $'\r': command not found

Any ideas ?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

It seems that you have Windows style line endings (\r\n) - you need to change them to unix style (\n). If you have dos2unix installed you could use it. You could also do it using sed or awk.

//Try running the dos2unix command on the file in question.

It might help when you see error messages like this:

-bash: '\r': command not found

Windows style newline characters can cause issues in Cygwin.

The dos2unix command modifies newline characters so they are Unix / Cygwin compatible.

CAUTION: the dos2unix command modifies files in place, so take precaution if necessary.

If you need to keep the original file, you should back it up first.

 

Link:- http://linuxcommand.org/man_pages/dos2unix1.html (How to use dos2unix)

//

EXAMPLES

Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. dos2unix a.txt -c iso b.txt Convert and replace b.txt in ISO conversion mode. dos2unix -c ascii a.txt -c iso b.txt Convert c.txt from Mac to Unix ascii format. dos2unix -c mac c.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date  stamp  of  e.txt  same  as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert  c.txt  and write to e.txt. Convert and replace a.txt.  Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
 

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

4 Replies

Avatar

Level 4

Please find attached the script. Changing the extension to .txt because it wasn't allowing to attach file of extension .sh.

Avatar

Correct answer by
Administrator

Hi 

It seems that you have Windows style line endings (\r\n) - you need to change them to unix style (\n). If you have dos2unix installed you could use it. You could also do it using sed or awk.

//Try running the dos2unix command on the file in question.

It might help when you see error messages like this:

-bash: '\r': command not found

Windows style newline characters can cause issues in Cygwin.

The dos2unix command modifies newline characters so they are Unix / Cygwin compatible.

CAUTION: the dos2unix command modifies files in place, so take precaution if necessary.

If you need to keep the original file, you should back it up first.

 

Link:- http://linuxcommand.org/man_pages/dos2unix1.html (How to use dos2unix)

//

EXAMPLES

Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. dos2unix a.txt -c iso b.txt Convert and replace b.txt in ISO conversion mode. dos2unix -c ascii a.txt -c iso b.txt Convert c.txt from Mac to Unix ascii format. dos2unix -c mac c.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date  stamp  of  e.txt  same  as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert  c.txt  and write to e.txt. Convert and replace a.txt.  Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
 

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 4

Hi Kautuk,

Thanks for the answer and it helped me getting the Author server started. However, I am now using the same approach to start a publish server on the same machine and here is my script but for some reason the publish is not getting started. Here is the script attached.