1827460 Members
4019 Online
109965 Solutions
New Discussion

Startup script errors

 
SOLVED
Go to solution
Warren griggs
Frequent Advisor

Startup script errors

Hi All,

I am currently hardening a box and have found some errors in the /etc/rc.log saying "^M" not found. I have searched all the scripts for any control characters but have found none and the problem seems to be calling the same script....

if [ -f /etc/rc.config ] ; then
. /etc/rc.config # problem line
else (etc)

I have found no control characters in this file either.
Does anybody have any idea whats wrong here?

Thanks in advance,
Colin.
3 REPLIES 3
Robin Wakefield
Honored Contributor
Solution

Re: Startup script errors

Hi Colin,

/etc/rc.config calls all your /etc/rc.config.d/* scripts, so I'd run:

sh -x /etc/rc.config

and look for the ^M error in the output. Maybe even copy the script and add a line to echo the name of each script as it is sourced then run:

. /etc/rc.config

this should then show you the offending file.

rgds, Robin
James R. Ferguson
Acclaimed Contributor

Re: Startup script errors

Hi Colin:

'/etc/rc.config' sources (reads) every file in '/etc/rc.config.d/' to collect environmental variables.

The presence of "^M" in some file within this directory is probably due to a editting a file on a PC and incorrectly doing a binary FTP transfer back to Unix.

Look in '/etc/rc.config.d' for the culprit. You can expose the "^M" by doing:

# for FILE in /etc/rc.config.d/*
> do
> cat -etv ${FILE}|more
> done

Regards!

...JRF...

Steven E. Protter
Exalted Contributor

Re: Startup script errors

It is also possible to get this error if you edited the script on the pc and saved it to a folder exported with CIFS or samba.

The specific problem you are having, I prevent by using vi on the host to edit configuration scripts.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com