-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5
-
Component/s: Packaging
-
None
-
ALL
-
Mongo 2.6.x sysv init script for EL6 isn't working correctly on 6u6. This is the output that standard start call returns:
# /etc/init.d/mongod restart
Stopping mongod: [ OK ]
Starting mongod: /usr/bin/dirname: extra operand `2>&1.pid'
Try `/usr/bin/dirname --help' for more information.
[ OK ]
Problem is that RedHat changed /etc/rc.d/init.d/functions, in a way that function __pids_var_run() contains new entry:
local pid_dir=$(/usr/bin/dirname $pid_file)
This is wrongly interpreted in daemon() function that Mongo uses. Problem is that $base is considered complete line:
"$NUMACTL $mongod $OPTIONS >/dev/null 2>&1"
This causes side effect:
+ base='null 2>&1' + __pids_var_run 'null 2>&1' '' + local 'base=null 2>&1' + local 'pid_file=/var/run/null 2>&1.pid' ++ /usr/bin/dirname /var/run/null '2>&1.pid' /usr/bin/dirname: extra operand `2>&1.pid' Try `/usr/bin/dirname --help' for more information. + local pid_dir=
and thus spitting out errors.
Solution is to use '--check' parameter for daemon() call. Here is proposing patch:
--- /etc/init.d/mongod 2014-10-08 10:29:50.000000000 -0700 +++ /tmp/mongod.patched 2014-11-19 10:42:41.000000000 -0800 @@ -27,6 +27,7 @@ PIDDIR=`dirname $PIDFILE` mongod=${MONGOD-/usr/bin/mongod} +servicename=mongod MONGO_USER=mongod MONGO_GROUP=mongod @@ -63,7 +64,7 @@ ulimit -u 32000 echo -n $"Starting mongod: " - daemon --user "$MONGO_USER" "$NUMACTL $mongod $OPTIONS >/dev/null 2>&1" + daemon --check $servicename --user "$MONGO_USER" "$NUMACTL $mongod $OPTIONS >/dev/null 2>&1" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mongod
- duplicates
-
SERVER-16081 init.d mongod startup script fails, with dirname message
- Closed