From: <jh...@us...> - 2009-04-02 00:21:36
|
Revision: 79 http://etch.svn.sourceforge.net/etch/?rev=79&view=rev Author: jheiss Date: 2009-04-02 00:21:34 +0000 (Thu, 02 Apr 2009) Log Message: ----------- Convert the cron wrapper script to Ruby so that the client package has no dependency on Perl. Modified Paths: -------------- trunk/client/control trunk/client/depend trunk/client/etch_cron_wrapper Modified: trunk/client/control =================================================================== --- trunk/client/control 2009-04-02 00:20:54 UTC (rev 78) +++ trunk/client/control 2009-04-02 00:21:34 UTC (rev 79) @@ -2,6 +2,6 @@ Version: 1.1-1 Maintainer: etc...@li... Architecture: all -Depends: ruby facter rcs libdigest-sha1-perl +Depends: ruby facter rcs Description: Etch client Modified: trunk/client/depend =================================================================== --- trunk/client/depend 2009-04-02 00:20:54 UTC (rev 78) +++ trunk/client/depend 2009-04-02 00:21:34 UTC (rev 79) @@ -1,5 +1,4 @@ P CSWruby P CSWfacter -P CSWpmdigestsha1 P CSWrcs Modified: trunk/client/etch_cron_wrapper =================================================================== --- trunk/client/etch_cron_wrapper 2009-04-02 00:20:54 UTC (rev 78) +++ trunk/client/etch_cron_wrapper 2009-04-02 00:21:34 UTC (rev 79) @@ -1,20 +1,18 @@ -#!/usr/bin/perl +#!/usr/bin/ruby -w -use Digest::SHA1 qw(sha1_hex); -use Sys::Hostname; -use strict; -use warnings; +require 'socket' +require 'digest/sha1' # Seed the random number generator with the hostname of this box so that # we get a consistent random number. We want to run the registration at a # consistent time on each individual box, but randomize the runs across # the environment. -srand(hex(substr(sha1_hex(hostname), 0, 7))); +srand(Digest::SHA1.hexdigest(Socket.gethostname)[0,7].hex) # Cron job is set to run every hour -my $MAX_SLEEP = 60 * 60; +MAX_SLEEP = 60 * 60 -sleep(int(rand($MAX_SLEEP))); +sleep(rand(MAX_SLEEP)) -exec '/usr/sbin/etch', '--generate-all'; +exec('/usr/sbin/etch', '--generate-all') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |