AEM on Linux CentOS as service | Community
Skip to main content
Level 4
December 4, 2015
Solved

AEM on Linux CentOS as service

  • December 4, 2015
  • 4 replies
  • 1590 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

4 replies

Lokesh_Shivalingaiah
Level 10
December 4, 2015

can you attach your shell script

Level 4
December 4, 2015

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

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
December 4, 2015

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
Level 4
December 4, 2015

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.