Questions tagged [exec]
exec is a functionality of an operating system that runs an executable file.
50
questions
0
votes
1answer
345 views
php exec returning 127 because /bin/sh is getting “Permission denied” in apache chroot
I have a php script that is trying to use exec (or shell_exec) to execute a binary on the system. The exec is failing with return code 127.
Return code 127 normally means command not found. So I made ...
0
votes
1answer
2k views
Systemd service not starting - 'Failed at step EXEC spawning… Permission denied'
I've read other answers for similar issues (Failed at step EXEC spawning... Permission denied) and none seem to apply.
After I upgraded my bitcoin node to v0.20.0 it is no longer starting on boot nor ...
0
votes
1answer
235 views
using find, exec and cp to copy specific files while preserving directory path
I set up the following folders with empty text files:
1/a.txt
2/b.txt
I want to copy only txt files to another directory while maintaining their directory structure. So I tried the following ...
0
votes
0answers
192 views
Influxdb is not showing up the measurement name which is pushed by collectd exec plugin
Am using collectd to collect the system metric and pushing into influx db.
To monitor the running process I wrote a script leveraged the collectd exec plugin to push my custo m metric into influx db.....
11
votes
1answer
27k views
Failed at step EXEC spawning… Permission denied
I have read alot about this but still not sure why this is not working. as far as I know all dirs have the right permission and even with everything being 777 I still get permission denied when trying ...
0
votes
0answers
290 views
exec() failing with return code 11
I have the following PHP script that isolates my issue:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$code = 0;
$output = array();
exec('"../vendor/bin/PdfGenie" code.rq', $output, ...
1
vote
1answer
31 views
Replacing Backup Exec 2010 R3 - Need Recommendations [closed]
I have been upgrading servers over the last few weeks, and stumbled on the realization that our current backup solution needs to change due to incoming incompatibilities. We currently use Symantec ...
1
vote
1answer
415 views
How to write standard output and error to log and from exec
For example, write standard err and standard output to $LOG. but this not print anything to standard output ( on console )
#!/bin/bash
LOG=/var/tmp/log
#...
exec > $LOG 2>&1
my target ...
0
votes
1answer
1k views
puppet variables set in exec environment not accessible elsewhere in the class
I'm trying to configure a logging figuration with log paths based on a check to see if that log file exists. However, the if statements always return true even though I know /var/log/hermes/hermes.log ...
1
vote
2answers
531 views
Issue with the combination of ssh, bash --login and exec
Here are few situations I'm in.
foo is the ssh server to which password less login is set up.
$ ssh foo
$ bash --login -c 'exec $0 "$@"' ls -lrt
It's working as expected.
ssh foo bash --login -c ls ...
1
vote
3answers
177 views
Error: Impossible to define SCIHOME environment variable
I am trying to use Scilab through PHP on my server like described in this document.
I am running Ubuntu 16.04. I have an Apache server running. I installed Scilab with apt-get install scilab. I can ...
1
vote
1answer
874 views
Call java binary from PHP not possible
Hi I would like to call java using PHP exec() function but it fails (no output of e.g. exec('/usr/bin/java -version').
I am running apache with PHP as Fast-CGI (with fcgid) on debian wheezy.
The ...
0
votes
1answer
411 views
When use “exec 1>ok.log”, how can I output the specified content to the screen within a shell script?
As follow, I only want the command echo "this is to stdout" output to my screen instead of to the file ok.log, how can I do?
I search for the usage of exec shell command, but without result, please ...
0
votes
2answers
238 views
How to direct errors from with a find exec command to a log file
Hi I have the following command that does yui optimizations and runs as a cron job. I want to log the output of the command to a log file.
find . -type d -exec bash -c "cd '{}' && pwd &&...
2
votes
2answers
6k views
mysqldump (using PHP exec) not dumping file but no error
I wasn't sure if this was a SO or SF question but I thought this might be the best place. I apologise if it is not!
I am using mysqldump through PHP exec but it doesn't seem to be working. The code I ...
0
votes
1answer
3k views
Puppet EXEC: execute part of code only after another part is executed
I have the following puppet code:
exec { 'set mysql root password':
user => root,
path => "/usr/bin:/usr/sbin:/bin",
command => "/usr/bin/mysqladmin -u root password \'${...
1
vote
0answers
4k views
PHP exec() Returns 127 When Trying To Run Any Command
I'm an intermediate Linux user (CentOS, some Debian) who is transitioning to FreeBSD (10). Permissions have always been somewhat confusing to me.
I've set up a server with PHP-FPM (5.6) and Nginx (1....
2
votes
1answer
2k views
sudo start my-project does not work
I'm using the following script in /etc/init/my-project.conf on my AWS instance.
description "start and stop the go program 'my-project'"
start on filesystem or runlevel [2345]
stop on runlevel [!...
2
votes
1answer
1k views
Php's shell_exec() and apache [closed]
I'm running a ZMQ 'push' interface via Ratche on an Apache server, which works very well on the command line, interacting with my server exactly the way I'd like. Here's the code
//script1.php
<?...
1
vote
2answers
311 views
Why perl backticks don't see anything past the first space?
I have a command
$output = `somecommand parm1 parm2`;
When I try to run this perl script I get.
Can't exec "somecommand" at .....
It seems it is not seeing anything past the first space in ...
0
votes
1answer
3k views
php-fpm does not work me exec or shell_exec
I have OpenBSD 5.6 and php-fpm, nginx.
Is chrooted by default on /var/www
I try:(test.php)
<?php
if(function_exists('exec')) {
echo "exec is enabled";
}else{
// it's not
echo "exec is ...
2
votes
2answers
8k views
Invalid argument when running 'find' command with -exec and -mtime
Pretty wierd error message came up on Centos.
I tried to run this command:
find /tmp/something -type f -mtime +2h -exec cp '{}' /tmp/target \;
And the error I've got:
find: invalid argument `-exec'...
0
votes
2answers
4k views
How to pass parameter for Exec from notify?
I've the following Puppet manifest:
# PHP Configuration
class php {
exec { "php5enmod $module":
path => "/usr/sbin",
command => "php5enmod $module",
}
file {'/etc/php5/conf.d/...
0
votes
2answers
1k views
Script out SQL Job Create Statement Without SSMS
Does anyone have an idea of how to generate the Create statement for a SQL Agent Job? I've looked everywhere, and I can't seem to find a search result that doesn't involve using SSMS and going ...
0
votes
1answer
150 views
Strange behavour of which in a shell script launched as a forked process
So I have a java process that is doing some automation. One of the things it has to do is find the JDK home on random machines.
So I wrote a shell script to try and find the JDK home assuming that ...
-1
votes
1answer
530 views
Multiple Background Processes at Single Line Works in The Foreground
I want to convert an uploaded PDF file to JPG images and zip these images after convert process finishes. I use the ImageMagick library's convert command for PDF to JPG conversion.
To accomplish ...
1
vote
3answers
1k views
Limit Exec Commands for Linux Users
How can I limit the scope of executable commands a linux user can run?
For example, I only want user to be able to run the ls command and nothing else. If tried, for example to run cat, linux would ...
-4
votes
2answers
688 views
Run a script.sh with www-data like it was root user [duplicate]
I need to get all mac Addresses from my network-card.
So i use nmap from Debian, combined with PHP.
But, without root privilege, this only gives me the IP address and status from a target. With root ...
1
vote
1answer
133 views
Results of not using '{}' in find /mnt/tmp -atime +91 -exec rm -f {} \;?
I have been using the following code for the longest on a system I took over:
find /mnt/tmp -atime +91 -exec rm -f {} \;
However, researching further I see everyone saying the curly braces should be ...
0
votes
0answers
836 views
Executing a command as apache
This script keeps outputting a 1. and I cannot understand why.
<?php
passthru("nohup sudo rndc reload sd.example.com",$op);
print_r($op);
?>
I have also tried the above code ...
-1
votes
2answers
114 views
Better way to exec at a specific folder
It is possible to exec at the specific folder, rather than I need to use two commands separately?
e.g.
cd /opt/folderA
exec ....
cd /opt/folderB
exec ....
1
vote
1answer
91 views
How do I exec finger with puppet?
My puppet file looks like this:
# Test finger harry harry.pp
exec {'harryd':
...
1
vote
1answer
2k views
ip netns exec permission denied
I have a php script, say file.php that contains:
<?php
exec("ip netns exec vpn file2.php");
?>
If I run file.php via the command line, as root, it works. However, when I run it via apache, www-...
4
votes
2answers
4k views
wkhtmltopdf call from PHP exec results in exit code 127 failure
Using CentOS 6.3x64.
I'm trying to run wkhtmltopdf (from here) from a PHP script. I can successfully call wkhtmltopdf-amd64 directly via SSH. But when calling it from PHP via exec, it always fails ...
1
vote
1answer
373 views
Solaris 10 snmp exec multiple strings
I am trying to use snmp to query a directory listing. I have added the exec line to snmp.conf ("exec list /bin/ls /pathtodirectory") and restarted the service. When I perform an snmp walk for the exec ...
0
votes
1answer
420 views
Monit runs exec action too often
I've written a script which sends me an sms notification. I call with exec action in monit test. It works, but I'm getting overwhelmed by messages. Is there a way to suppress sending subsequent ...
1
vote
1answer
3k views
Need to execute script file using sudo - run from teamcity
I need to execute a script in Linux platform "runme.sh" (which can be executed as sudo user) using another ant script "build.xml". Now i have execute this build.xml from teamcity.
I have code for ...
11
votes
1answer
9k views
How do I configure SSHd to permit a single command, without giving full login access to the user?
I am looking for best way to call remote command over SSH. I create user 'rpcall', generate new certificate and fill authorized_keys. Secure it little bit more with
from="ip",no-agent-forwarding,no-...
0
votes
2answers
13k views
Puppet: exec onlyif value is not equal
I have a script that really only needs to be run one time on a server, i.e. at deployment time, but figured it would be best to have Puppet manage it. The script remaps several legacy user id's that ...
1
vote
1answer
3k views
ffmpeg fails inside PHP exec(); [closed]
I am trying to get info from a file with ffmpeg, if inside php I have this code:
exec("ffmpeg -i ffmpeg_directory/4.flv");
Returns nothing, even tough same command inside SSH would print a large ...
3
votes
1answer
2k views
Fedora 15 PHP exec() does not work
I cannot run an executable by PHP exec() function.
OS: Fedora 15
PHP safe_mode off
PHP code is:
$exe = "/tmp/defne/./CwCssUGxhjAc";
$result = system( $exe, $retval );
chmod 777 on /tmp/defne and /...
0
votes
1answer
382 views
Shell script Process PID logging and maintenance using exec
I am trying to launch a java process as a server and then might periodically need to restart/kill it at certain times. Since I use a shell script to launch java jvm(to build classpath), I thought of ...
1
vote
2answers
908 views
Is it ok for php sites running Magento to have the exec function enabled?
We offer a service for Magento sites that requires installation of a Magento extension. For large sites, this extension needs to run a background process which requires the exec function. Our ...
5
votes
4answers
8k views
Permission denied to remount tmp for exec
I'm running Fedora Linux on MediaTemple using their (ve) virtual Linux box. Pretty much a clean install (Linux ************ 2.6.18-028stab089.1 #1 SMP Thu Apr 14 13:46:04 MSD 2011 x86_64 x86_64 x86_64 ...
4
votes
1answer
1k views
exec sudo and/or send signal to child
I would like to execute an application (gnutls-cli) as another user and send a signal to it (SIGALRM). Unfortunately this does not work:
sudo -u myuser gnutls-cli -p smtp imap.gmail.com --starttls &...
0
votes
1answer
146 views
execute command on icmp request
I'd like to know how/if it is possible to get my linux (ubuntu) box to exec a command (script) on incoming icmp/ping (or other network events) requests?
Like e.g. playing a "ping" sound when being ...
0
votes
4answers
3k views
CGI error from PHP when running exec() on IIS
Windows Server 2003 x64
PHP 5.2
IIS 6.0
The program Ink2Png.exe is set with Everyone->Read and Execute permissions.
As does its dependency (microsoft.ink.dll)
PHP Safe Mode is off
exec() is ...
2
votes
4answers
7k views
php rsync with exec() not working
Why this:
rsync -avz -e ssh /home/userneme/folder username@domain.com:/var/www/folder
works from cronjob and this:
exec("rsync -avz -e ssh /home/userneme/folder username@domain.com:/var/www/folder")...
0
votes
2answers
679 views
Exclude pings from apache error logs (ran from PHP exec)
Now, for a number of reasons I need to ping several hosts on a regular basis for a dashboard display.
I use this PHP function to do it:
function PingHost($strIpAddr) {
exec(escapeshellcmd('...
0
votes
2answers
3k views
php can't execute any external command?
We moved from Slackware to CentOS here, it was working fine then without notice, php stopped executing external calls such as calls to "wc" and "spamc". All such calls appear on error_log as:
sh: /...