概要
Ubuntu 14.04.4 の Docker でZabbix agent を static library で作る - Qiita
これを作って、ほかのマシンで動いているとおもわれる、/etc/init.d/zabbix_agentd を持ってきたのだが動かなかった。
結論
start-stop-daemon で -u または --user しているところを -c にしたら動いた。
経過
最初にでていたエラー
# /etc/init.d/zabbix_agentd start
Starting Zabbix agent daemon: zabbix_agentd
zabbix_agentd [3611]: user zabbix does not exist
zabbix_agentd [3611]: cannot run as root!
その時点でのスクリプト
start)
echo "Starting $DESC: $NAME"
start-stop-daemon --oknodo --start --pidfile $PID \
--user $USER \
--exec $DAEMON -- -c /etc/zabbix/zabbix_agentd.conf
;;
ここで、--userを-cにしたら
# /etc/init.d/zabbix_agentd start
Starting Zabbix agent daemon: zabbix_agentd
#
man start-stop-daemon より抜粋
-u , --user についての記述
チェックするのに使うと書いてある。
-u, --user username|uid
Check for processes owned by the user specified by username or
uid. Note: using this matching option alone will cause all pro‐
cesses matching the user to be acted on.
-c についての記述
プロセスを実行する前に、username/uidに変更すると書いてある。
-c, --chuid username|uid[:group|gid]
Change to this username/uid before starting the process. You can
also specify a group by appending a :, then the group or gid in
the same way as you would for the `chown' command (user:group).
If a user is specified without a group, the primary GID for that
user is used. When using this option you must realize that the
primary and supplemental groups are set as well, even if the
--group option is not specified. The --group option is only for
groups that the user isn't normally a member of (like adding per
process group membership for generic users like nobody).
疑問
うまく動いていると思っているところでは一体何がおこっているのか。。。