Esmith::util::system

From SME Server
Revision as of 13:29, 19 June 2015 by Stephdl (talk | contribs) (Created page with "=== NAME === esmith::util::system - replacements/wrappers for system() commands === SYNOPSIS === use esmith::util::system qw(killall rsync rsync_ssh); killall($signal, @c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

NAME

esmith::util::system - replacements/wrappers for system() commands

SYNOPSIS

use esmith::util::system qw(killall rsync rsync_ssh);
killall($signal, @commands);
rsync($src, $dest, @options);
rsync_ssh($src, $dest, $user, $ident, \@rsync_opts, \@ssh_opts);

DESCRIPTION

This is for common functions that would normally require a system(...) command. Makes things easier to document, test and upgrade. If you find yourself writing a system() command, consider putting it in here.


Functions

These may be pure Perl functions or they may well just be wrappers around system() commands.

Each can be imported on request.

killall

my $killed_something = killall($signal, @commands);

Sends a $signal to all of the named @commands. $signal can be specified by name or number (so 1 or HUP for example, names are prefered). Returns true if something was killed, false otherwise.

rsync

my $success = rsync($source, $destination, @options);

rsyncs the $source file or directory to the $destination. Any @options are direct options to the rsync command.

rsync will be run --quiet by default.

Returns true if the rsync succeeds, false otherwise.

rsync_ssh

my $success = rsync_ssh($src, $dest, $user, $ident, \@rsync_opts,
                                                                  \@ssh_opts);

Like rsync() except it uses ssh. A typical call might be:

rsync_ssh('some.host:', 'some/file', 'someuser', 'some/.ssh/identity',
                        [qw(--archive --delete)]);

AUTHOR

Mitel Networks Corporation


perl v5.10.1 2003-09-02 esmith::util::system(3)