This the bash script (dpa_report.sh) that creates the REST -API report. I have taken out the actual username and password for the purposes of this post. If I run this script from the command line and pass it the hostname it works. For example
works. The hostname is set to $1 in the script.
But when dpa_report.sh is called from the php script I get the permission errors.
Hello everybody:
Im trying to run the following script on my sol9 machine:
line=''
((lineCount= 0))
export lineCount
more /tmp/MSISDNs | wc -l > /tmp/tmp
cat /tmp/tmp | read lineCount
export lineCount;
while (( lineCount > 0 ))
do
line= tail -$lineCount... (5 Replies)
I'm just not sure where to start looking into this. I want to be able to create switches for my script. Back in the day I'd make my scripts interactive...you know:
echo "what report do you want"
echo "A)boxes with errors"
echo "B)boxes with more than 5 errors"
echo "C)Service groups that have... (3 Replies)
Hi All,
I need to pass a variable to perl script from bash script, where in perl i am using if condition. Here is the cmd what i am using in perl
FROM_DATE="06/05/2008"
TO_DATE="07/05/2008"
"perl -ne ' print if ( $_ >="$FROM_DATE" && $_ <= "$TO_DATE" ) ' filename"
filename has... (10 Replies)
How do I pass a bash variable to a javascript?
I've tried
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<head>"
counter=0
echo '<script>
window.parent.document.forms.counter.value = "$counter";
</script>'
I have an iframe script which I am trying to pass a... (3 Replies)
Hello,
How can I pass a variable into a 2nd file? I'm running a script:
ls -la $1 >pem99
cat pem99 | awk '{ print $3}' >us99
cat us99 | read us98
This then tells me the owner of a file.
my second file is:
echo OWNER GROUP OTHERS
echo
echo --data-- $us98
... (2 Replies)
Hello everyone,
I've been looking how to pass variables between bash and php-cli in 1 file. So far i got this:
#!/bin/bash
echo "This is bash"
php << EOF
<?php
echo "This is php\n";
?>
EOF
I would now like to be able to pass a variable declared in the bash to the php. I already... (0 Replies)
Would really appreciate it if someone could point out my mistake in this line of code, i've been staring blankly at it trying everything i can think of some time now and coming up with nothing.
#!/bin/bash
echo "Enter Username"
read Username
awk -F: -v var=${Username} '/^var:/... (9 Replies)
I'm trying to write a basic bash script that takes input you give (what directory, if any, what name, if any ....) and passes the information to find.
I'm trying to just create a string with all variables and then pass it to find. So far I have this extremely simple:
#!/bin/bash -f
... (2 Replies)
Hi,
I wanted to pass an argument to a bash script. So that the argument is used inside the awk command inside the bash script.
I know the noraml way of passing argument to a bash script as below :
sh myScript.sh abc
Inside the bash script i can use like this
myArg1=$1
wc $myArg
But... (8 Replies)
Hi All,
I need to pass a variable from bash script to perl script and in the perl script i am using those variables in the sql query but its giving
error :
Use of uninitialized value $ENV{"COUNTRYCD"} in concatenation (.) or string at /GIS_ROOT/custom/tables/DBread_vendor.pl line 50.
Can ... (6 Replies)
Discussion started by: NileshJ
6 Replies
LEARN ABOUT DEBIAN
netdot::client::rest
Netdot::Client::REST(3pm) User Contributed Perl Documentation Netdot::Client::REST(3pm)NAME
Netdot::Client::REST - RESTful API for Netdot
SYNOPSIS
use Netdot::Client::REST;
my $netdot = Netdot::Client::REST->new(
server=>'http://localhost.localdomain/netdot',
username=>'admin',
password=>'xxxxx',
);
# Get all devices
my @devs = $netdot->get('/Device');
# Get Device id 1
my $dev = $netdot->get('/Device/1');
# Get Device id 1 and foreign objects one level away
my $dev = $netdot->get('/Device/1?depth=1');
# Update Device 1
$dev = $netdot->post('/Device/1', {community=>'public'});
# Delete Device 1
$netdot->delete('/Device/1');
See examples/ directory for a sample script
DESCRIPTION
Netdot::Client::REST can be used in Perl scripts that need access to the Netdot application database. Communication occurs over HTTP/HTTPS,
thus avoiding the need to open SQL access on the machine running Netdot.
CLASS METHODS
new - Constructor and login method
Arguments:
server - Netdot installation URL (e.g. http://host.localdomain/netdot)
username - Netdot username
password - Netdot password
retries - Number of retries (default: 3)
timeout - seconds (default: 10)
format - Representation format (default: xml)
Currently only XML is supported
Returns:
Netdot::Client::REST object
Examples:
my $netdot = Netot::Client::REST->new(
server =>'http://host.localdomain/netdot',
username => 'myuser',
password => 'mypass',
);
INSTANCE METHODS
get - Get all attributes from one or more Netdot objects
Arguments:
Resource - string containing RESTful resource
In addition to the object's class and (optional) ID, the HTTP argument "depth"
allows the user to fetch all foreign objects recursively, limited by the
value of the depth argument. Foreign objects include relational records
referenced by the given object and records that reference the given object (both
sides of the one-to-many relationship). The performance impact of the given depth
is a balance between fewer queries with large datasets and more queries with smaller
datasets. The default depth is 0 (only return the given object plus references
to objects directly related).
Returns:
hashref with object's attributes
A special attribute is added for each foreign key that allows the programmer
to request that resource more easily. For example, if a record has a field
called 'foo' which is a foreign key pointing to a record of class 'Bar',
with id '1', then the result hashref will include a keys like:
foo => 'Foo bar name',
foo_xlink => 'Bar/1',
where 'foo_xlink' can be passed to this method to get the full Bar/1 resource.
Examples:
my $dev = $netdot->get('Device/1');
my $dev = $netdot->get('Device/1?depth=1');
my @alldevs = $netdot->get('Device');
my @mydevs = $netdot->get('Device?sysname=mydev');
post - Update or Insert a Netdot object
Arguments:
Resource - string containing RESTful resource
data - Hashref containing key/value pairs
Returns:
hashref with object's attributes
Examples:
$netdot->post('Device/1', \%data);
$netdot->post('Device', \%data);
delete - Delete a Netdot object
Arguments:
Resource - string containing RESTful resource
Returns:
True if successful
Examples:
$netdot->delete('Device/1');
AUTHOR
Carlos Vicente <cvicente@cpan.org>
SEE ALSO
The Network Documentation Tool <http://netdot.uoregon.edu>
LICENCE AND COPYRIGHT
Copyright (c) 2012, Carlos Vicente <cvicente@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
perl v5.14.2 2012-02-18 Netdot::Client::REST(3pm)