Bug 213412 - net-mgmt/telegraf: rc script hangs due to stdout not being redirected
Summary: net-mgmt/telegraf: rc script hangs due to stdout not being redirected
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Palle Girgensohn
URL:
Keywords:
: 214643 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-12 11:44 UTC by Steven Hartland
Modified: 2016-11-23 00:24 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (girgen)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Hartland freebsd_committer 2016-10-12 11:44:43 UTC
Only stderr is redirected in telegraf rc script resulting in a hang when trying to restart it remotely e.g.
ssh mymachine /usr/local/etc/rc.d/telegraf restart

The fix is to also redirect stdout as shown by the patch below

Index: files/telegraf.in
===================================================================
--- files/telegraf.in   (revision 423837)
+++ files/telegraf.in   (working copy)
@@ -29,7 +29,7 @@
 start_precmd=telegraf_prestart
 pidfile="/var/run/${name}.pid"
 command=/usr/sbin/daemon
-command_args="-crP ${pidfile} %%PREFIX%%/bin/${name} ${telegraf_flags} -config=${telegraf_conf} 2>> /var/log/telegraf.log"
+command_args="-crP ${pidfile} %%PREFIX%%/bin/${name} ${telegraf_flags} -config=${telegraf_conf} >> /var/log/telegraf.log 2>&1"
 
 telegraf_prestart() {
 # Have to empty rc_flags so they don't get passed to daemon(8)
Comment 1 cheffo 2016-11-22 21:40:13 UTC
Please see bug 214738 - it contains fix and also update to latest version of telegraf. 
Thanks!
Comment 2 Palle Girgensohn freebsd_committer 2016-11-23 00:17:52 UTC
*** Bug 214643 has been marked as a duplicate of this bug. ***
Comment 3 Palle Girgensohn freebsd_committer 2016-11-23 00:19:07 UTC
214738 contains a suggested fix and has a complete update as well.
Comment 4 commit-hook freebsd_committer 2016-11-23 00:24:32 UTC
A commit references this bug:

Author: girgen
Date: Wed Nov 23 00:23:49 UTC 2016
New revision: 426880
URL: https://svnweb.freebsd.org/changeset/ports/426880

Log:
  Update telegraf to 1.1.1

  Make sure both stdin and stderr are redirected since daemon(8) forks and this
  would otherwise leave scripted restarts haning. See #213412 and #214643 for a
  more complete discussion.

  PR:		214738, 213412, 214643
  Submitted by:	Stefan Lambrev

Changes:
  head/net-mgmt/telegraf/Makefile
  head/net-mgmt/telegraf/distinfo
  head/net-mgmt/telegraf/files/telegraf.in