08-10-2009
Is it possible to incorporate this into a while loop, so that it would ping every 5 seconds or so, and if '$?' is -ne to 0, keep pinging until $?= 0 (then once it does equal 0, continue with the script)? I came up with one sample, but of course, it didn't do anything, but give me a nice error
![Smilie Smilie](https://www.unix.com/images/smilies/smile.gif)
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
a little help.
I need to test the return code of a list file command on a remote system (Unix) using the rsh command. More exactly, to test is a directory exists, I try the following command:
rsh $remoteHost "ls -la " $DirRemote
Now, if the $DirRemote is not correct and I test... (3 Replies)
Discussion started by: gio123bg
3 Replies
2. UNIX for Advanced & Expert Users
I need to execute a script from dev server which is located on Test server.I can use ftp to connect to dev server and from there how can i execute a command on test server.
Thanks (5 Replies)
Discussion started by: ukatru
5 Replies
3. Shell Programming and Scripting
Hi,
I need to copy few files from remote server to local server.
I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed.
... (5 Replies)
Discussion started by: arunkumarmc
5 Replies
4. Programming
Hi,
I have 1. lappy
2. server A
3. server B
Now, what i need is to run a command from lappy that will sftp a file from server A to server B.
Please guide me to achieve this.
-akash (1 Reply)
Discussion started by: akash.mahakode
1 Replies
5. Shell Programming and Scripting
Hi guys,
So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies
6. Shell Programming and Scripting
Hello,
In our Data Warehouse environment, before our batch SFTP jobs kick off to pull the files from remote servers, I would like to setup a pre-sftp job that would test if all the remote servers from where the files are being pulled, are up and running. If any one of the remote serer is... (2 Replies)
Discussion started by: Dippu
2 Replies
7. Shell Programming and Scripting
Hello Every one!!
I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server.
Before this I am using a sudo command to change the user.
The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies
8. UNIX for Beginners Questions & Answers
Hello, :)
I'm trying to test if a remote directory exist per ssh, I have already made a ssh key and it works :
#!/bin/bash
HOST="10.10.1.22"
FILE_PATH="/var/wwww/html"
ssh -q $HOST ] && echo "Directory exists" || echo "Directory does not exist";
Output :
... (4 Replies)
Discussion started by: Arnaudh78
4 Replies
9. Shell Programming and Scripting
I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code
TARFILE=${NAME}.tar
TARGZFILE=${NAME}.tar.gz
ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies
LEARN ABOUT DEBIAN
test::mockmodule
Test::MockModule(3pm) User Contributed Perl Documentation Test::MockModule(3pm)
NAME
Test::MockModule - Override subroutines in a module for unit testing
SYNOPSIS
use Module::Name;
use Test::MockModule;
{
my $module = new Test::MockModule('Module::Name');
$module->mock('subroutine', sub { ... });
Module::Name::subroutine(@args); # mocked
}
Module::Name::subroutine(@args); # original subroutine
DESCRIPTION
"Test::MockModule" lets you temporarily redefine subroutines in other packages for the purposes of unit testing.
A "Test::MockModule" object is set up to mock subroutines for a given module. The object remembers the original subroutine so it can be
easily restored. This happens automatically when all MockModule objects for the given module go out of scope, or when you "unmock()" the
subroutine.
METHODS
new($package[, %options])
Returns an object that will mock subroutines in the specified $package.
If there is no $VERSION defined in $package, the module will be automatically loaded. You can override this behaviour by setting the
"no_auto" option:
my $mock = new Test::MockModule('Module::Name', no_auto => 1);
get_package()
Returns the target package name for the mocked subroutines
is_mocked($subroutine)
Returns a boolean value indicating whether or not the subroutine is currently mocked
mock($subroutine => &coderef)
Temporarily replaces one or more subroutines in the mocked module. A subroutine can be mocked with a code reference or a scalar. A
scalar will be recast as a subroutine that returns the scalar.
The following statements are equivalent:
$module->mock(purge => 'purged');
$module->mock(purge => sub { return 'purged'});
$module->mock(updated => [localtime()]);
$module->mock(updated => sub { return [localtime()]});
However, "undef" is a special case. If you mock a subroutine with "undef" it will install an empty subroutine
$module->mock(purge => undef);
$module->mock(purge => sub { });
rather than a subroutine that returns "undef":
$module->mock(purge => sub { undef });
You can call "mock()" for the same subroutine many times, but when you call "unmock()", the original subroutine is restored (not the
last mocked instance).
original($subroutine)
Returns the original (unmocked) subroutine
unmock($subroutine [, ...])
Restores the original $subroutine. You can specify a list of subroutines to "unmock()" in one go.
unmock_all()
Restores all the subroutines in the package that were mocked. This is automatically called when all "Test::MockObject" objects for the
given package go out of scope.
SEE ALSO
Test::MockObject::Extends
Sub::Override
AUTHOR
Simon Flack <simonflk _AT_ cpan.org>
COPYRIGHT
Copyright 2004 Simon Flack <simonflk _AT_ cpan.org>. All rights reserved
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
perl v5.10.0 2005-03-24 Test::MockModule(3pm)