Bug 213412

Summary: net-mgmt/telegraf: rc script hangs due to stdout not being redirected
Product: Ports & Packages Reporter: Steven Hartland <smh>
Component: Individual Port(s)Assignee: Palle Girgensohn <girgen>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: Mark.Martinec, cheffo
Priority: --- Flags: bugzilla: maintainer-feedback? (girgen)
Version: Latest   
Hardware: Any   
OS: Any   

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 @@
-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. 
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

  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