Programming :: Call Shell Script In Perl Pm

Sep 4, 2010

i used ldap for authentication.now i have a perl script that users use it for login(contact.pl),then this script calls a shell script(ip.sh) for create iptables chain.

when i call that into contact.pl ,it just prints: usr/sbin/iptables but ip chains didn't change.what is problem? whenever run ip.sh in bash it works correctly

View 10 Replies


ADVERTISEMENT

Programming :: Perl: Determine Error Origin / Meaning In Code Call

Jan 20, 2010

I've been requested to modify a perl backup script we use which mounts a networked NAS machine. The actual mount command is called inside a system() command. In testing, I can do a test of the return value, so I'm able to tell whether or not I've mounted properly, but I can't make heads or tails out of the return on deliberate errors. (Such as mounting a non-existent box.) I'm displaying the returned value, which is 256 in my tests. The man page for mount listed error messages with values from 1 to 64, but no higher. Am I drawing this error value from the system command somehow? And what would be the best way to determine what this error means?

View 6 Replies View Related

Programming :: Scenario For Call Shell Function From Mysql?

Apr 18, 2011

I am trying a scenario for calling a shell script when ever a trigger is called. Can some one guide me how to achieve this scenario. Also it should passes the value from the table to the shell script. Can some one explain me along with the example.

View 2 Replies View Related

Programming :: CGI Shell Scripting : Possible To Call Function From Other Script?

Mar 15, 2011

I got two cgi shell scripting files. Is it possible when i am in file 1, to call a function from file 2?

View 2 Replies View Related

Programming :: QNX Checksum Call In Cgi Shell Scripting Not Working?

Mar 11, 2011

I have a QNX machine with a slinger webserver running on it. With a cgi script i'm trying to do the QNX cksum call and compare it's output value with a fixed output. When i execute the script at the command line it works perfect, but when execute this script by by the webserver in my browser it doesn't work. Here's my code:

#!/bin/sh
FILE="/home/checkfile"
ORIGCHECK="1712885500"

[code].....

Could it be possible that i'm not allowed to do the cksum call in combination with the slinger webserver?

View 4 Replies View Related

Programming :: Compare Two Files Using Perl Or Shell Scripting?

Mar 8, 2010

I want to compare the following two tab-delimited .txt files (both were subsets of the original files) by comparing Columns 3 and 4 simultaneously. It is easy to compare C3 because both C3s are just numbers. But how to compare C4s?Basically, in File1, "G,G" = G in File2, "C,C" = C in File2, "A,A" = A in File2, "T,T"= T in File2.In File2, A/T in Column4 just equals "A,T" or "T,A" in Column4 of File1. C/T in Column4 just equals "C,T" or "T,C" in Column4 of File1, and etc.

File1:

C1C2 C3C4
ih509rs12345467244750"G,G"
ih499rs6049687244911"C,C"
ih508- 7244977"A,A"

[code]....

View 2 Replies View Related

Programming :: 32512 Error Code In Perl When Trying To Run Shell Command?

Nov 29, 2010

when I execute the command from the shell command line - it works and no error code.if I do the exact same command from a perl file - it fails with code 32512.the file is created from the same perl script that runs the command that fails. file permission is 0664.

Code:
#! /usr/local/pkg/perl-5.8.8/bin/perl
print "Content-type: text/html

[code]...

View 3 Replies View Related

Programming :: Perl About System Command / Fails If The Standard Shell Is Dash And Not Bash?

Jun 30, 2011

I am trying to fix a perl script, and I really suck at perl. But I think this problem will be easy for people who know it.

The problem is, I have an old setup script someone wrote many years ago. It fails if the standard shell is dash and not bash. The only way I've gotten it to work is to point /bin/sh to bash. I looked thru the script and it uses "system" many places, and I think that's the problem.

I searched for it and found this link:url

My plan is to include this function:

Code:
sub system_bash {
my @args = ( "bash", "-c", shift );
system(@args);
}
Then I could simply change all calls to system into system_bash and it should work?

The parameter to the system calls is usually some variable. What if the parameter is a list already? Do I need to test for it somehow, and if it's a list, prepend "bash" and "-c" to the list? How do I do that?

In the script there are lots of places like this:

my $error = system($cmd);
if ($error) {
die/warn "some error message";
}

Shouldn't there be a return in the system_bash function?

View 8 Replies View Related

Red Hat :: Call CGI W/POST Variables From Shell?

Jun 16, 2009

I've got a CGI that I'm trying to debug. Apache gives me an ambiguous 500 error; it would be nice to see the raw output via the shell. I've got the POST request w/headers as follows. What's the best way to troubleshoot this?

POST /cgi/packBoxes.cgi HTTP/1.1
Host: 70.87.60.214
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

[code].....

View 1 Replies View Related

General :: Call Makefile From Shell Script

Apr 12, 2011

I can find all kinds of information on calling a script from a makefile but not the other way around.I'm writing a VERY basic shell script, and I need to call a makefile located in a directory lower than the shell script but can't seem to figure it out../dir/make and ./dir/makefile don't work.

View 2 Replies View Related

General :: Call A Script In New Shell From Current?

May 3, 2010

How to call script b from inside script a in a new shell.

View 2 Replies View Related

Ubuntu Networking :: Call Shell Script On Network Change?

Jan 21, 2011

I have a script that I would like to run when my laptops connects to a new network (e.g. changes to another SSID). I've done some searching on the net but could not find any suitable solution (but I bet there is).

View 6 Replies View Related

Networking :: Run Shell Script From Perl?

Sep 4, 2010

i want to run/call shell script from perl, i used this system( "sh", "script.sh", "--help" );The 'script.sh' contains IPTables firewall script, but that's not run.i test 'script.sh' with a simple thing such create a chain only, but it not doing.How to run a shell script from a Perl program?

View 4 Replies View Related

Server :: Running A Shell Script With Perl?

Jun 27, 2009

quick guidance on running a bash script using Perl. The script is calledarchive_web.sh.The regular script I have and use now (archive.sh) creates an archive directory (uses the current date as the dir name) and moves all existing files there.The script is cronned to run every day before midnight. I'd like to be able to run this "archiving script"manually, from the web, at my own discretion, rather than necessarily wait till midnight (but want it to run then, too, in case any new files present themselves in the directory).These shell scripts sit in an .htaccessed directory. Talk about making up verbs all over the place.

View 1 Replies View Related

Software :: Automated Download Problem - Shell Ftp Vs Perl

Jun 1, 2009

I recently set up an automated shell script (bash on Ubuntu 8.10) to download new files from a server using ftp. Unfortunately the other end of the link is not terribly stable (and there is nothing I can do about this) which has resulted in the script hanging sometimes and then being kicked off again at the time set in the crontab.

This has resulted in multiple hung sessions taking up all the system resources.

The offending section of code is given below.

Code:

I'd like to know if there is a way I can force an exit if the connection hangs or alternatively if something like the Perl Net::FTP can handle these sorts of errors internally.

View 3 Replies View Related

Ubuntu :: Correct Usage Of Perl Expression In 'rename'-shell Command

Jan 21, 2011

I want to rename some files in one directory and found the command 'rename' most appropriate.

Changing the file extension is easy since there are lot of examples for this.

But now I want to rename my files like this:

'somePrefix_blablabla.ext' --> '0_blablabla.ext'
'somePrefix_blablablablabla.ext' --> '0_blablablablabla.ext'

I DON'T want an incrementation, just the leading prefix '0_'

correct perl expression syntax for this?

View 2 Replies View Related

General :: Finding A Recursive Shell Or Perl Script To Delete Files With The Same Name As The Parent Folder?

Jun 29, 2010

is there a recursive shell or Perl script to delete files with the same name as the parent folder? i wish to include the starting folder name as argument to the script.

View 2 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Programming :: Add Switch To Every Gcc/g++ Call?

Feb 23, 2009

I was wondering if there was a way to add a switch to a gcc/g++ call everytime. I have a few libraries that I need to compile for different processors. Each has a makefile which calls gcc to compile. Here is the best option I could come up with so far:Include a Makefile and define CC as gcc -mcpu=xxx.

View 4 Replies View Related

Programming :: Call C Executable Inside C

Jan 8, 2010

i have only basic knowledge of C so guys plz help me...is C language support call the C executable inside the C ?example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C <my C program call the executable ( A ) > .

View 9 Replies View Related

Programming :: Execvp System Call?

Apr 3, 2011

in below program why was new_args[0], rather than the reference the_cmd, passed to the execvp system call?

Code:
/*
A _very_ limited shell program

[code]....

View 2 Replies View Related

Programming :: Call The Executable File From The GUI?

Jun 1, 2010

I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.

View 4 Replies View Related

Programming :: How To Call Fortran Subroutine From IDL

Sep 29, 2010

There are examples everywhere about calling f77 subroutine from IDL, but I have not found any material about IDL calling fortran written in f90 way(free style). I tried the following example, but write the subroutines in free style. When I run the makefile, it gives an error 'undefined reference to main_'.

Code:

SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
INTEGER*4 argc, argv(*) !Argc and Argv are integers
j = LOC(argc) !Obtains the number of arguments (argc)

[code]....

View 1 Replies View Related

Programming :: Socket Programming In Module Perl

Jul 21, 2010

Where is the perl module for programming with sockets?

View 4 Replies View Related

Software :: Script That Call A Java Program That Call A System Command?

Nov 29, 2010

In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab

View 4 Replies View Related

Programming :: SSL_write Returns SSL_ERROR_SYSCALL, EOF On Second Call

Oct 8, 2010

I am facing issue in my OPENSSL code. I have written openssl client. It sends request to the host and receives response for that request.

My problem is, it connects, sends request successfully to host at first time only in sencond attempt it fails on SSL_write(). where SSL_get_error() returns SSL_ERROR_SYSCALL error.

In that ERR_get_error() returns 0. man page shows "If ret == 0, an EOF was observed that violates the protocol".

Code Snippet.
w=SSL_write(SSLRequestData.ssl,c2s,c2sl);
switch(SSL_get_error(SSLRequestData.ssl,w))
{
case SSL_ERROR_NONE:
if(c2sl!=w)

[Code]....

View 3 Replies View Related

Programming :: Clarification In The Select System Call?

Dec 8, 2010

I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know.
I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..

View 2 Replies View Related

Programming :: C - System Call & Error Checking?

Sep 18, 2010

I am trying to figure out how i would go about finding out where system call is made and error checking is not done. I have code below, if somebody can point me in the right direction where system call is made but error checking is not done.Quote:

#include "shell.h"
#include <stdio.h>
#include <string.h>

[code]....

View 5 Replies View Related

Programming :: How To Use Bashrc To Redirect Executable Call?

May 24, 2011

I need to redirect a /usr/sbin/sendmail command to $HOME/bin/msmtp .The sendmail command would be coming from a PHP5 application. I'm assuming the best way is to use .bashrc, but .htaccess is also available.The remote server is a shared web host which is running Debian 4.0.I do not have root access.I have SSH access.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved