summaryrefslogtreecommitdiff
path: root/examples/perfcounter/perfcountd.init
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-11-08 16:33:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:21 -0500
commit77460a90756dcaa54ec12bbcd30a5266286103d7 (patch)
treeaac95461d5cf4b3c0d9dc450bb78e8c2f6fef2d9 /examples/perfcounter/perfcountd.init
parent38b54d063d7fd262902324e5da15205542878adf (diff)
downloadsamba-77460a90756dcaa54ec12bbcd30a5266286103d7.tar.gz
r11579: syncing up perf counter code cfrom trunk
(This used to be commit 59c00924b67aa3d37a933731a56d03963ec7f1b5)
Diffstat (limited to 'examples/perfcounter/perfcountd.init')
-rwxr-xr-xexamples/perfcounter/perfcountd.init66
1 files changed, 66 insertions, 0 deletions
diff --git a/examples/perfcounter/perfcountd.init b/examples/perfcounter/perfcountd.init
new file mode 100755
index 00000000000..bb4148e52f6
--- /dev/null
+++ b/examples/perfcounter/perfcountd.init
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# Copyright (C) Gerald Carter 2005
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+####################################################################
+
+## This file should have uid root, gid sys and chmod 744
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+killproc()
+{
+ pid=`ps aux | grep $1 | egrep -v '(grep|perfcountd)' | awk '{print $2}'`
+ if [ "$pid" != "" ]; then
+ kill $pid
+ fi
+}
+
+# Start/stop processes
+
+case "$1"
+in
+start)
+ /opt/samba/bin/perfcount -d -f /var/lib/samba/perfmon 2> /dev/null
+ if [ $? -ne 0 ]; then
+ echo "Failed!"
+ exit 1
+ fi
+ echo "done!"
+ ;;
+stop)
+ killproc perfcount
+ ;;
+
+status)
+ pid=`ps aux | grep perfcount | egrep -v '(grep|perfcountd)' | awk '{print $2}'`
+ if [ "$pid" == "" ]; then
+ echo "Dead!"
+ exit 2;
+ fi
+ echo "OK!"
+ ;;
+restart)
+ $0 stop && $0 start
+ ;;
+
+*)
+ echo "Usage: $0 { start|stop|restart|status }"
+ ;;
+esac
+
+