[PATCH mogilefs] Use saner name in process listing.

Robin H. Johnson robbat2 at gentoo.org
Sun May 13 07:15:47 UTC 2007


Normally the binary will turn up in the process list as:
/usr/bin/perl $SCRIPTNAME

By adding a single line, we can make it be simply '$SCRIPTNAME'.
This makes writing init.d scripts signficently easier.

Signed-off-by: Robin H. Johnson <robbat2 at gentoo.org>
---
 server/mogautomount |    3 +++
 server/mogdbsetup   |    3 +++
 server/mogilefsd    |    3 +++
 server/mogstored    |    3 +++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/server/mogautomount b/server/mogautomount
index 68ca723..f3cefe6 100755
--- a/server/mogautomount
+++ b/server/mogautomount
@@ -3,6 +3,9 @@
 use strict;
 use Getopt::Long;
 
+# Rename binary in process list to make init scripts saner
+$0 = $_ = $0;
+
 my ($help, $verbose);
 usage(0) unless GetOptions(
                            'help' => \$help,
diff --git a/server/mogdbsetup b/server/mogdbsetup
index 155dbf9..ecf29ad 100755
--- a/server/mogdbsetup
+++ b/server/mogdbsetup
@@ -4,6 +4,9 @@ use Getopt::Long;
 use lib 'lib';
 use MogileFS::Store;
 
+# Rename binary in process list to make init scripts saner
+$0 = $_ = $0;
+
 my %args = (
             dbhost => "localhost",
             dbname => "mogilefs",
diff --git a/server/mogilefsd b/server/mogilefsd
index b8224f3..2b64c32 100755
--- a/server/mogilefsd
+++ b/server/mogilefsd
@@ -12,6 +12,9 @@ use warnings;
 use lib 'lib';
 use MogileFS::Server;
 
+# Rename binary in process list to make init scripts saner
+$0 = $_ = $0;
+
 my $s = MogileFS::Server->server;
 $s->run;
 
diff --git a/server/mogstored b/server/mogstored
index ccb26c4..1c7ed4a 100755
--- a/server/mogstored
+++ b/server/mogstored
@@ -47,6 +47,9 @@ my $default_config = "/etc/mogilefs/mogstored.conf";
 my $server      = $ENV{MOGSTORED_SERVER_TYPE} || "perlbal";
 my $serverbin   = "";
 
+# Rename binary in process list to make init scripts saner
+$0 = $_ = $0;
+
 my %config_opts = (
                    'iostat'       => \$opt_iostat,
                    'daemonize|d'  => \$opt_daemonize,
-- 
1.5.1.4



More information about the mogilefs mailing list