LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Memcached startup script (https://www.linuxquestions.org/questions/linux-server-73/memcached-startup-script-742433/)

moazam 07-24-2009 05:47 AM

Memcached startup script
 
Hello,
I am totally new to linux world. I am trying to configure memcached on centos but its throwing me two error. I was wondering if someone here could help me on this.

I am following startup script from here http://www.vbseo.com/blogs/danny-bem...-memcached-44/

when I try to run this
[root@host]# /etc/init.d/memcached restart

it throws me this error
: bad interpreter: No such file or directory

i also tried sh command and then it gave this error
: No such file or directory 14: /etc/rc.d/init.d/functions

i just commented this line then i was keep getting : numeric argument required 22: exit: 0 error.

Please let me know what I am doing wrong. I saw httpd file it had also similar code and I checked this file /etc/rc.d/init.d/functions its on same place.

Any help would be much appreciated.

Thanks,
Moazam

dxangel 07-24-2009 06:44 AM

(edited)

Apologies, didnt read your post right - im not awake yet!

So assuming the interpreter is set, and youre running as root, have you checked that the file exists in the place the script is looking for it?

moazam 07-24-2009 06:48 AM

Quote:

Originally Posted by dxangel (Post 3618739)
Do have this line in your script? needs to be the first line:

Code:

#!/bin/bash
ETA:

secondly, are you running the script as root?

1) I don't know, but I checked httpd file it had also same line. How do I check this?

2) Yes running as root

dxangel 07-24-2009 06:58 AM

this should also help you

http://www.linuxquestions.org/questi...preter-204902/

moazam 07-24-2009 07:17 AM

Quote:

Originally Posted by dxangel (Post 3618758)

tried this command unix2dos /etc/init.d/memcached but didn't work

memcached file is already chmod 0755

EricTRA 07-24-2009 07:24 AM

Hi,

If you want to use the script on a linux box and 'wrote' it in Windows environment you'll have to use dos2unix instead of unix2dos.

If you open the file with vi -b (for binary and executable files) and you see things like ^M at the end of each line, that's when you need to either delete those characters or run the dos2unix command.

Kind regards,

Eric

dxangel 07-24-2009 07:29 AM

i think you mean dos2unix? not unix2dos.

moazam 07-24-2009 07:58 AM

Quote:

Originally Posted by EricTRA (Post 3618776)
Hi,

If you want to use the script on a linux box and 'wrote' it in Windows environment you'll have to use dos2unix instead of unix2dos.

If you open the file with vi -b (for binary and executable files) and you see things like ^M at the end of each line, that's when you need to either delete those characters or run the dos2unix command.

Kind regards,

Eric

Excellent worked fine.. just had a little problem while converting file by using this command dos2unix

i was using dos2unix /etc/init.d/memcached it was giving me an error.. i googled and found i have to first change directory to init.d and then run this command.

Thanks everyone for helping me on this. :)

dxangel 07-24-2009 08:36 AM

glad to help.

EricTRA 07-25-2009 01:23 AM

You're welcome. Glad to be of assistance.

Kind regards,

Eric


All times are GMT -5. The time now is 12:55 PM.