diff logstash.rc @ 4:29ffaf4e0a7f

keep 7 days of data; more readable init script
author Carl Byington <carl@five-ten-sg.com>
date Thu, 07 Mar 2013 21:24:02 -0800
parents 796ac0b50dbf
children 6b7beb807d14
line wrap: on
line diff
--- a/logstash.rc	Thu Mar 07 10:41:01 2013 -0800
+++ b/logstash.rc	Thu Mar 07 21:24:02 2013 -0800
@@ -47,14 +47,15 @@
 #
 do_start() {
     cd $HOME
-    pid=$(su logstash -c 'echo -e "'"$JAVA $ARGS"' </dev/null >'"$LOGFILE"' 2>&1 & \n echo \$!" | bash')
+    pid=$(
+    exec sudo -u logstash /bin/bash - <<EOF
+        $JAVA $ARGS </dev/null >$LOGFILE 2>&1 &
+        echo \$!
+EOF
+    )
+    #pid=$(su logstash -c 'echo -e "'"$JAVA $ARGS"' </dev/null >'"$LOGFILE"' 2>&1 & \n echo \$!" | bash')
     echo $pid >$PIDFILE
     [ -n "$pid" ] && success $"$base startup" || failure $"$base startup"
-    # might try
-    #id
-    #exec sudo -u transmission /bin/sh - << eof
-    #id
-    #eof
 }