Bug#492138: rsync init script status action

View: New views
1 Messages — Rating Filter:   Alert me  

Bug#492138: rsync init script status action

by Dustin Kirkland-4 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Package: rsync
Version: 3.0.3-1
Severity: normal
Tags: patch

The rsync init script could really use a 'status' action, as defined in
the LSB specification [1].  Such an action allows a system administrator
to poll the service's init script and retrieve the status (running or
not) of the daemon.

Recently, a new function, status_of_proc(), was added
to /lib/lsb/init-functions that makes this relatively trivial.  I've
attached a patch that adds this functionality.

[1] http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
--
:-Dustin

Dustin Kirkland
Ubuntu Server Developer
Canonical, LTD
kirkland@...
GPG: 1024D/83A61194

[rsync.debian.patch]

diff -u rsync-3.0.3/debian/control rsync-3.0.3/debian/control
--- rsync-3.0.3/debian/control
+++ rsync-3.0.3/debian/control
@@ -8,7 +8,7 @@
 
 Package: rsync
 Architecture: any
-Depends: ${shlibs:Depends}, lsb-base (>= 3.0), base-files (>= 4.0.1), sysv-rc (>= 2.86.ds1-14.1ubuntu2)
+Depends: ${shlibs:Depends}, lsb-base (>= 3.2-14), base-files (>= 4.0.1), sysv-rc (>= 2.86.ds1-14.1ubuntu2)
 Suggests: openssh-client, openssh-server
 Description: fast remote file copy program (like rcp)
  rsync is a program that allows files to be copied to and from remote
diff -u rsync-3.0.3/debian/init.d rsync-3.0.3/debian/init.d
--- rsync-3.0.3/debian/init.d
+++ rsync-3.0.3/debian/init.d
@@ -144,9 +144,12 @@
             [ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in /etc/default/rsync, not starting..."
         fi
  ;;
+  status)
+ status_of_proc -p /var/run/rsync.pid "$DAEMON" rsync && exit 0 || exit $?
+ ;;
 
   *)
- echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart}"
+ echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart|status}"
  exit 1
 esac
 



signature.asc (196 bytes) Download Attachment
LightInTheBox - Buy quality products at wholesale price