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
ADVERTISEMENT
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
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
View Related
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
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
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
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
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
Apr 8, 2009
I am trying to setup the wlan access for my Fedora 9 system. I installed ndiswrapper. But when I run
Code:
ndiswrapper -l
i am getting the error
Code:
/usr/bin/perl: symbol lookup error: /usr/bin/perl: undefined symbol: PL_use_safe_putenv
View 11 Replies
View Related
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
Jan 8, 2010
I Have shell script like this
Code:
#!/usr/bin/expect
set password "XXXXXXXX"
[code]...
View 13 Replies
View Related
Aug 11, 2010
I am new here and want to lern CentOS. Current I have installed CentOS 5.5 x64 and Perl 5.8.8. Now i have install Perl 5.12.1 which located to /usr/local/bin/perl. But how I can move it to /usr/bin/perl so root based on Perl 5.12.1?
View 7 Replies
View Related
Jul 7, 2010
I am trying to launch the perl config, but when I do so I can an weird error.It seems to be that it does not regonize perl ?
conf.pl: line 11: =: command not found
conf.pl: line 19: my: command not found
conf.pl: line 20: syntax error near unexpected token `{'
[code]...
View 2 Replies
View Related
Aug 14, 2010
I recently reinstalled the B module for perl. Now I found out it didn't just do that, it installed a whole new copy of perl into /usr/local/bin/perl. When I type 'which perl' at the terminal, it says '/usr/local/bin/perl' instead of '/usr/bin/perl'. Normally, this wouldn't bother me. But I installed the one in local/bin without threading support. The one that comes with the system already is build with threading support, which is why I want to switch back to the system perl, and possibly remove the one in /usr/local/bin.
So how do I change it so that the result of 'which perl' returns as '/usr/bin/perl'? And what do I have to do to remove /usr/local/bin/perl?
The reason I need threading support is because I'm designing a file copier that copies several chunks of a file simultaneously to speed up the copying process. Guaranteed a useful script if it works.
View 7 Replies
View Related
Jun 28, 2010
I'm new in perl programming and linux OS. What is the difference between perl and perl-devel? What does mean devel? Iwant to install Catalyst and before install as required I have to check if make, gcc and perl-devel are installed in my system. make and gcc are installed. But I have to install perl-devel. First I searched for make, gcc and perl-devel in YAST Software Management and search did not find perl-devel. I visited the software.opensuse.org and wrote "perl-devel" and searched. The result was many similar zips with a prefix perl-devel and I can not choose one for needed perl-devel.
[Code]...
View 5 Replies
View Related
Jul 14, 2010
I'm searching for a small perl script to iterate through the configured eth and vlan interfaces to get their assigned ip address and perform some processing.I'm after something like:
@interfaces = (waytogetinterfaces);
foreach (@interfaces){
#perform processing
print "Interface IP is: ", $_->IP;
}
View 2 Replies
View Related
Jun 2, 2011
I am unable to run perl-cgi script in my cent os Apache server. I have used locate perl command in terminal window and it gives following result:
[code]....
tell which is the path to perl for example "usr/bin perl"
View 13 Replies
View Related
Apr 28, 2011
teste.domain.com:
Code:
<VirtualHost *:80>
ScriptAlias /cgi-bin/ /home1/_sites/teste/site/cgi-bin/
<Directory /home1/_sites/teste/site/cgi-bin/>
Options FollowSymLinks +ExecCGI
AllowOverride None
[Code]...
View 2 Replies
View Related
Apr 19, 2011
I need to refer a sample code to develop a network simulator using c++/system c as back end and perl scripting asd front end.CAn anyone please refer to me any websites were this kind code is given.I do not want to use this otcl script language so wothout this is any code available just for sample so i wii know were to start and develop my own code.
View 3 Replies
View Related
Mar 10, 2011
is it possible using a perl script to test for a socket listening on a UDP port on a remote host ?I work in an environment where netcat is not allowed and from time to time I need to see if a UDP port is open on a remote host.
View 6 Replies
View Related
Dec 17, 2010
I have a small problem with Perl and Apache.
If I use "#!/usr/bin/perl" in the beginning of a perl script the script won't work if the script is at all complicated. Simple scripts like "Hello World" works.
But if I use "#!/usr/bin/perl -w" in the beginning all scripts work?
If I don't use the -w this is whats in the logs:
(2)No such file or directory: exec of '/home/test.net/html/cgi-bin/uh/meny.pl' failed
Premature end of script headers: meny.pl
When I use the -w in the script the error-log shows me this.
meny.pl: Name "main::http_path_cgi" used only once: possible typo at /home/test.net/html/cgi-bin/uh/meny.pl line 24.
View 1 Replies
View Related
Jun 15, 2011
MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.
View 2 Replies
View Related
Mar 14, 2010
I want to change my default shell to tcsh. I used
Code:
usermod -s /bin/tcsh username
command as given at url
But if I open a new shell, it is still a bash shell.
How do I make my default shell as tcsh?
View 6 Replies
View Related
Jul 26, 2010
I am using ubuntu10.04-server 64bit AMD with fluxbox. After I ran Matlab in a shell (without GUI) the shell does not display characters anymore, but will execute any command, I just can't see the characters that I'm typing.. I use aterm and xterm, does anybody know why that is, am I missing a package?
View 1 Replies
View Related
May 10, 2011
command1:
ssh pt@192.168.1.101 ls
command2:
ssh pt@192.168.1.101 totem ~/t1
Cannot open display: Run 'totem --help' to see a full list of available command line options. command1 can run, command2 can not run,would you mind to tell me why?
View 2 Replies
View Related
Apr 11, 2011
I am trying to create a shell script (CGI) which will create a website with an embedded flash mp3 player. At the same time I want this script to overwrite the file currently in the playlist with another file which will allow me to change the song currently playing on the flash player. The reason I am doing this is so that I can copy the song I want to play to this file at a low bitrate reducing its size. The code I am using in my script is:
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<object type="application/x-shockwave-flash" allowscriptaccess="always"
[Code]....
When I run the script the new page does not have the flash player and the song did not change.
View 6 Replies
View Related
Apr 14, 2010
I am looking for a secure way to backup data from user's computers ( Linux/Windows ).My needs :
1. Secure
2. Per user backups
3. Windows/Linux compatible ( server will be Linux only )
4. Incremental backups
My preferences :
1. Rsync
Things I can not do :
1. Give out shell access ( forget rsync -e ssh )
2. Use a protocol that takes too many ports ( my box is behind my router ).
View 5 Replies
View Related
Apr 14, 2011
Is there any way I can switch my desktop shell from unity to, say, gnome-shell? I can switch using other console shell I like (bash, csh, fish, etc.). Assume that there is a stable alternative desktop shell, I should be able to choose, too.
(For console shell, we goes to /etc/passwd. But for desktop, I can't find the way to config.)
View 2 Replies
View Related
May 21, 2009
Is there a way to export a variable to parent shell in shell scripting ?
View 3 Replies
View Related
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