08-01-2011
executing a different program
What system calls or commands do I need to use in order to execute a different program from an already running process?
10 More Discussions You Might Find Interesting
1. Programming
Read the title: how do i do it? (4 Replies)
Discussion started by: Gekko
4 Replies
2. UNIX for Dummies Questions & Answers
Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2.
I can do manually in this way:
#su - s2
#enter password for s2> somePassword
$ p1
But all this I have to do through a java program. How to pass the password through program.
One... (1 Reply)
Discussion started by: shailendrat
1 Replies
3. Programming
Hi all,
I tried writing an .ec program connecting to informix database
from solaris platform Sun 5.7
informix version that i had to used when i compiled the program was 9.21.UC3
the binary when i ported solaris box with informix version 9.40.UC5 i am unable to run that
i am encountering... (0 Replies)
Discussion started by: matrixmadhan
0 Replies
4. Programming
Hi ,
I m actually trying to implement pipes program,but after executing the execvp(),my program is getting hanged up :mad:
Actaully i m getting the desired output expected from execvp()...but once results are displayed on the output screen ,program is getting hanged up
values of... (3 Replies)
Discussion started by: Crab
3 Replies
5. Programming
I wrote a code like this.......
#include <iostream>
#include <stdio.h>
#include <mysql.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
#include "Connection.h"
int main()
{
char *Host = (char *)"localhost";
char *Database =(char *)"sachin";
char... (3 Replies)
Discussion started by: ps_sach
3 Replies
6. Solaris
hey everybody,
i am currently working on solaris 10 os on a m5000 server. my problem is when i want the exact size of a program in execution, i am unable to do it. earlier i thought the RSS field of prstat but because of its large size it cant be the size. pmap -x shows some output but it includes... (2 Replies)
Discussion started by: aryansheikh
2 Replies
7. Shell Programming and Scripting
I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies
8. Shell Programming and Scripting
Hello,
Please help me out to execute this perl program:
#!/usr/bin/perl -w
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...
# get already active Excel application or open new
my... (6 Replies)
Discussion started by: suvenduperl
6 Replies
9. Shell Programming and Scripting
Overview:
I have an AWK program that parses thru a database backup
server log file and outputs ths following parameters
SRNO DATE : TIME SIZE IN(KB) DATABASE NAME DUMP TYPE
1 May 16 2012: 13:30:00 6874 TestDB database
2 May 16 2012: 13:30:44 11462 master database
Problem:
This program has... (5 Replies)
Discussion started by: JolietJake
5 Replies
10. Programming
Hello Friends,
I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies
SYSTEM(3) 1 SYSTEM(3)
system - Execute an external program and display the output
SYNOPSIS
string system (string $command, [int &$return_var])
DESCRIPTION
system(3) is just like the C version of the function in that it executes the given $command and outputs the result.
The system(3) call also tries to automatically flush the web server's output buffer after each line of output if PHP is running as a
server module.
If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru(3)
function.
PARAMETERS
o $command
- The command that will be executed.
o $return_var
- If the $return_var argument is present, then the return status of the executed command will be written to this variable.
RETURN VALUES
Returns the last line of the command output on success, and FALSE on failure.
EXAMPLES
Example #1
system(3) example
<?php
echo '<pre>';
// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ls', $retval);
// Printing additional info
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>
NOTES
Warning
When allowing user-supplied data to be passed to this function, use escapeshellarg(3) or escapeshellcmd(3) to ensure that users can-
not trick the system into executing arbitrary commands.
Note
If a program is started with this function, in order for it to continue running in the background, the output of the program must be
redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.
Note
When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not
allowed to have .. components in the path to the executable.
Warning
With safe mode enabled, the command string is escaped with escapeshellcmd(3). Thus, echo y | echo x becomes echo y | echo x.
SEE ALSO
exec(3), passthru(3), popen(3), escapeshellcmd(3), pcntl_exec(3), backtick operator.
PHP Documentation Group SYSTEM(3)