Programming :: Executing An External Command With Python (CGI)

Jul 8, 2011

I need to execute an external command with Python from Web. I know there is subprocess module that executes external programs but I'm trying to execute a command registered for the execution of a program. In this case when I execute my file in the shell everything is Ok, but from the Web it doesn't work.

View 1 Replies


Programming :: Make Python Programs Run Without Entering The Command Python?

Mar 22, 2009

I want to be able to do

sudo ./

instead of always having to do

sudo python

What do I need to change?

View 5 Replies View Related

Programming :: Executing Shell Command In JSP

Aug 24, 2010

what we are trying to do is, to let the customer click a button in the web browser, and then the web server to call a shell script to do the work. The output from the stdout && stderr of the script should be displayed in the web browser once finished or timeout, along with the exit code of the script.

The shell script is however not on the web server, but on another app server. So to call this script from the web server as the identity 'tomcat':

$ sh appuser@app-server:$appbin/app-script

The .ssh/ thing is done, and we have no problem doing this in the command line so far.

Our loaded ex-colleage has left us the webpages (jsp) with code like these:

<%@ include file="jsp_functions.jsp" %>
String cmd = "sh $appbin/app-script";
ExecResult r = new ExecResult();


View 6 Replies View Related

Programming :: Run External Program From Python Script?

Dec 21, 2009

I want to be able to run a program in a python script, and capture it's output in a variable. I figured out that I can execute it with os.system(), but how do I capture it's output and store it in a variable?

View 1 Replies View Related

Programming :: Bash Script: Assign Command Ouput To A Variable Without Executing It?

Feb 12, 2011

I'm trying to execute the following command within a bash script:

tac /var/log/system.log | head -1
The script I wrote is:


View 1 Replies View Related

Programming :: Python: Commands.getoutput (command) Fails

May 26, 2010

I've writte a small Munin plugin using python, which basically runs a shell command, and write the output to a file. For some reason the script fail quite often, and it seems to be failing at the "commands.getoutput" statement. This is what's leading up to that statement:


View 4 Replies View Related

Programming :: System Command / 'mcc' Is Not A Recognised As An Internal Or External Command?

Apr 13, 2010

I am writing a perl script which uses the matlab compiler to compile a .m file.

I am using the system("mcc �m file.m"). I have matlab installed and both script and exe are in the same drive.But i get the following error .

'mcc' is not a recognised as an internal or external command ,operable in program or batch file.

View 5 Replies View Related

Programming :: Python - Call Function From The Command Line After Compile The Program?

Dec 28, 2010

If i have a python file with a function call_me(a,b),how can I call this function from the command line ,after i compile the program?

View 5 Replies View Related

Programming :: Executing "su" Command From Java

Nov 11, 2010

I'm developing a Servlet which when it gets a request, it has to execute a command. I've tried in Windows and it works fine, but when I "install" my web app in Linux, if I try to execute the commands I get permission error.

An example of one command I'm trying to execute is: Runtime.getRuntime.exec("rm file_name"); -> This commands outputs that I don't have permissions.

If I add "su" before the command, how do I add the password?

View 4 Replies View Related

Programming :: Python - Get Text File Data Into An Array On Python?

Nov 30, 2009

I've already used line split stuff to transform my data into something like this in a text file:


['1', '1', '3', '20.7505207']
['2', '1', '3', '23.0488319']
['3', '1', '3', '-1.5768747']
['4', '1', '3', '-26.4772491']


How can I get this on a python program so I can manipulate it as an array?

View 3 Replies View Related

CentOS 5 :: Executing Bash On External Drive

Jun 7, 2010

I have a CentOS system totally devoted to a 500GB disk. I have an additional disk mounted via an external device that will not execute scripts that are located on that device.

Current hardware configuration:
t [root@localhost ~]# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 60801 488279610 8e Linux LVM

Disk /dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 * 1 42261 339457466+ 83 Linux
/dev/sdd2 42261 60801 148925985+ 5 Extended
/dev/sdd5 59372 60801 11486443+ 82 Linux swap / Solaris
/dev/sdd6 42261 58671 131814400 83 Linux
/dev/sdd7 58671 59371 5623808 82 Linux swap / Solaris

Partition table entries are not in disk order
[root@localhost ~]# uname -a
Linux localhost 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:08:30 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

View 17 Replies View Related

Ubuntu :: Permission Denied For Executing Files On The External Storage?

Jan 24, 2010

I have a dual boot Dell Studio laptop with Windows (VISTA) and Ubuntu (9.0.4) installed on it. I have recently installed Ubuntu to make it a dual boot. Before that I was using LiveUSB Ubuntu image for six months (without any problems).

During the installation of Ubuntu, I created a Linux partition of 2GB for Ubuntu installation (assuming that it was running successfully on my 2GB USB drive). All of my other work (e.g. documents/programming projects etc.) are stored on the Windows partition (which is loaded during the boot time automatically). The problem is that I get a "permission denied" error while running any executable file on the Windows partition. But if I copy the same executable on the Linux partition, everything works perfect. Am I missing something here?

I have verified that the executable have necessary execute permissions.

View 4 Replies View Related

Programming :: Python 2.x - Represent The Same In Python 3.x

Mar 4, 2010

I have a function definition in a Python 2.x script which take a tuple as one of its arguments, but 2to3 has no answers nor any of my searching on how to represent the same in Python 3.x


def blah(self, (string1, string2))

View 4 Replies View Related

General :: Executing Command Over A Network?

Aug 6, 2010

I have a some c source code files that i have to copy to linux machine from a windows machine over a network. This source code folder has to be copied into a particular directory structure in the linux system at the other end. After copying the file into the appropriate folder in the linux server i have to instruct the linux machine to make(using the make file that is there with the c files) this source code from the windows machine. Does anyone have any idea in regard to how this can be implemented?? i am trying to have a gui client that has the above mentioned options(copying and inserting the c files into the appropriate directory and then for making the files and getting the executable.)

View 3 Replies View Related

OpenSUSE Install :: Executing Command At Boot?

Apr 7, 2010

im searching for this answer now a pretty long time and i know that many similar questions where asked and i all looked themIm trying to run a the command "vncserver" on our opensuse11.2 server when its booted.many posts here endet in "put a sh script into your /kde4/Autostart" but that didtn help for me because the server runs without a screen and normally nobody is logged in. When i logged in that worked fine.i also tried to add the command "vncserver" to "/etc/init.d/boot.local " but that didnt work too. i think its to early executed to work.i also tried to activate the service to start up at boot with chkconfig vncserver start but the service vncserver is "unknown". when i type vncserver into the console after logging in everything is see i really tried a lot and searched a long time at google and in this forum but nothing worked

View 4 Replies View Related

General :: Executing A Shell Command In Emacs?

Dec 17, 2010

I tried to execute a shell command by M-! cmd RET but it did not work.M-! does not turn up in the microbuffer no matter how many times I press Alt+!.But if I go to Tools menu and select Shell Command... option then it writes M-! to the microbuffer and everything works fine.What is the problem here?

View 2 Replies View Related

Red Hat / Fedora :: DNS - Command Not Executing (Connection Refused)

Mar 31, 2010

I want to fix my dns if I issue command service named restart it just wont execute the command all it say is connection refused error from rc.d just cannot figure out what the problem is my server is ruining on red hat Linux 9 which is also my proxy server.

View 6 Replies View Related

General :: Executing A Program From Command Prompt?

May 27, 2011

I'm trying to run an application from the command prompt. I've set the path in .bashrc. My executable file and all other files needed by it are saved in the same directory as the path. When I enter the executable name to run it, I get an error message saying that the command is not found.

View 14 Replies View Related

Software :: Executing The Command On The Remote Machine

Oct 5, 2010

If I type this manually on the command line, it works


ssh -Y user@machine 'firefox &'

I ssh into the remote machine as the named user and pop an instance of firefox from that machine back to my own. If I put the same thing into a shell script though, it fails.


ssh -Y user@machine 'firefox &'

I'm just left sitting at a command line on the remote machine. Why does the script fail and how can I make it work?

View 4 Replies View Related

General :: Ssh'ing To A Host And Executing A Command Not Working Correctly?

Aug 20, 2010

I have the following command:ssh $USER@$HOST "ls /ops/pkg/ec/`grep "PKRTS" /ops/pkg/ec | awk '{print $1}'`* > /tmp/tmp_file"What the above SHOULD, ssh to the host then execute the command.The command should first execute the grep and awk between the back ticks, and generate a file name, then ls using that filename* and write that data to a temp file.However, it executes the grep and awk before even SSH'ing and the command that goes to the server is simply an "ls /ops/pkg/ec/* > /tmp/tmp_file" since the grep and awk return nothing on the local machine.

View 1 Replies View Related

Ubuntu :: Error When Executing 'gnome-terminal' Command

Feb 11, 2010

I wrote a shell script and tried to execute it in separate terminal using command 'gnome-terminal -e <script>'. When executing first time, it went fine.From second time, I am getting error 'There is error creating child process for this terminal' repeatedly.

View 5 Replies View Related

Ubuntu Servers :: Executing PHP File Via Command Line

Nov 16, 2010

I have a php file that I need to execute via a cronjob. This file should be run by the www-data user as its a file in my /var/www/project folder. When I run this file under root (php -f cron.php) everything works perfectly, but I want it to run under the www-data to be safe. Before I run it vai crontab I tried it via command line as the www-data user and I receive errors:

Fatal Error: Allowed memory size of 8388608 bytes expired (tried to allocate 232 bytes).

But when I run it as the root user I get no errors and everything works correctly. The file cron.php is used to process automated tasks in my CRM. So I don't really want to have the root user running a crontab every few minutes for this.

Must the www-data user be given more permissions? I am using Ubuntu 6.06LTS
PHP - 5.1.2
Apache - 2.0.55
MySQL - 5.0.22

View 4 Replies View Related

Ubuntu :: Cron Daemon Is Running But The Command Isn't Executing?

Mar 28, 2011

I was just curious if cron had to be enabled before use. i have a crontab, and the cron daemon is running, but the command isn't executing...

View 9 Replies View Related

General :: Executing An Awk Command Inside Perl Script?

Jul 30, 2011

I want to execute a awk command, which reads from txt files and sums the numbers from the first column for those listed only inside a <init> block -- The awk command is like


awk '/</?init>/{x = !x}x{a++}x && a > 2{sum+=$1}END{printf"%E" "
", sum}

So, I want to execute it inside a perl script, and execute the awk command for the infile which is also defined outside awk loop, ie doing something like


foreach $infile (@ARGV) {
$gzin = gzopen($infile, "r") || die ("Couldn't open file $infile
# No. events and cross-section from current file


View 1 Replies View Related

General :: Executing Scp Command: Missing Dependency Libcrypto.a

Jun 14, 2011

When i try to execute scp command:

scp -r /localhostdirectory username@remotehostservername:/remotehostdirectory

I get the following error

0509-036 Cannot load program /usr//bin/ssh because of the following errors:
0509-150 Dependent module /homepath/server/bin/libcrypto.a( could not be loaded.
0509-153 File /homepath/server/bin/libcrypto.a is not an archive or
the file could not be read properly.
0509-026 System error: Cannot run a file that does not have a valid format.

View 6 Replies View Related

Fedora Networking :: Error In Executing The Command Ndiswrapper -i Bcmw15.inf

Nov 13, 2009

I use a Dell inspiron 1525, with windows 7 and fedora 8 in dual boot. Ihave broadcom 4310 wireless card to use.. how ever i could not activate my wireless.. so i guess this the right place where i can get a solution to the problem. After installing the ndsiwrapper by yum, i tried to execute the command ndiswrapper -i bcmw15.inf This returns with an error couldn't open bcmw15.inf: No such file or directory at /usr/sbin/ndiswrapper line 219.

View 1 Replies View Related

Red Hat / Fedora :: Executing A File - Showing Error - Command Not Found

Aug 23, 2010

I m using Redhat Linux 5......I am trying to install Nero 4 DVD Writer s/w...It is an exe file ...

I have given permission like this:

Then i execute the file like this:

Its showing error like this:

View 9 Replies View Related

Programming :: GNU C - Timer Not Executing

Mar 3, 2011

Why is the timer not executing?

Code: #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <pthread.h>
void func(union sigval sv)

View 1 Replies View Related

Ubuntu Networking :: BackTrack 5 Showing Error,while Executing Make Command?

Aug 3, 2011

I tried to install ndiswrapper , but its showing error,while executing make command

make[1]: Leaving directory `/usr/src/linux-source-'
make: *** [LINUX] Error 2

View 2 Replies View Related

Programming :: Totem Python Plugin Programming: Any Signal For Video Mouse Click?

Feb 9, 2011

I want that I click with the mouse on the video, it paused.I notice that there is "BaconVideoWidget" which I guess is the video rendering widget but it don't have signal named "clicked":

vd = totem_object.get_video_widget()
vd.connect("clicked", vd.hide)


View 3 Replies View Related

Copyrights 2005-15, All rights reserved