I am trying to create the correct syntax for sed to fix a common problem via scripting. The problem is reproducible by installing MongoDB on CentOS 6.5 and results in a warning:
Quote:
/usr/bin/dirname: extra operand '2>&1.pid'
|
I found, here, that there is a solution. Just edit the /etc/init.d/mongod file to remove that from line 66.
Code:
<line 66>
daemon --user "$MONGO_USER" "$NUMACTL $mongod $OPTIONS >/dev/null 2>&1"
It works consistently, and now I am trying to script it using sed. I am using this line to try and do so:
Code:
sed `s/S \>\/dev\/null 2\>\&1/S/` /etc/init.d/mongod
I think I have this all escaped properly, but no matter what I do, it keeps giving me one of 2 errors which do not make sense to me. If I don't escape it as above, I get something to the effect of:
And with it as above (which seems right to me), I get:
Quote:
-bash s/S: No such file or directory.
|
Now I do know this is a hardlink and that *may* be the issue - at least I read that it does cause issues in Solaris due to an inode mismatch. But being able to edit it directly makes me think this isn't the issue here. The only other option I have is that I don't have everything escaped correctly, but I don't know what or where I am missing it.