execute shell command with php

im trying to execute a bash script with a php/html button to wake my nas.

<form action="" method="POST"> <input type="submit" value="Wake NAS" name="zero" /> </form> <?php if (isset($_POST["zero"])){ #echo "Hello World!"; shell_exec("/var/www/html/wakenas.sh &"); }?>

"Hello World" is printed when button is pressed. but code won't be executed. the wakenas.sh looks like this and works if i execute it over shell

#!/bin/bash etherwake -D "BC:5F:F4:09:E1:07" echo "why!?!?!" > "/var/www/html/works.txt" exit 1

wakenas.sh has all rights

Maybe you guys know why it wont be executed.

thanks in advance

Category:php Views:4 Time:2018-09-11
Tags: shell php bash

Related post

  • execute multiple shell commands with php nohup 2010-08-11

    I want to execute multiple shell-commands with php's exec command. The commands have to be made sequentially and I want to start them with nohup so it can run in the background and my php-script doesn't have to wait for it to finish. Here's my script

  • Run shell commands with PHP? 2010-08-28

    Occasionally my media server goes down and I'm wondering if it's possible to start it remotely using php to check the port and if it's not running invoke cron (or some other way) to run a shell command. Is this possible because this is not a strong a

  • Executing shell commands using PHP, e.g. shell_exec() etc., on a remote host? 2010-09-19

    Is it possible to execute shell commands on a remote computer (not localhost)? For instance things like $output = shell_exec("unzip filename.zip"); You can assume that you have the login credentials of a user account on the remote machine, as well as

  • how to execute shell command with arguments? 2012-03-15

    I`m trying to execute a shell command with arguments in C# , and "The system cannot find the file specified" is thrown. I`ve tried: p.StartInfo.FileName = Directory.GetCurrentDirectory() + "\\timesync\\NistClock.exe sync"; the path is correct 100% Ni

  • Bash script execute shell command with Bash variable as argument 2011-07-30

    I have one loop that creates a group of variables like DISK1, DISK2... where the number at the end of the variable name gets created by the loop and then loaded with a path to a device name. Now I want to use those variables in another loop to execut

  • Python - how to execute shell commands with pipe? 2012-02-22

    I have a case to want to execute the following shell command in Python and get the output, echo This_is_a_testing | grep -c test I could use this python code to execute the above shell command in python, >>> import subprocess >>> su

  • Specify private SSH-key to use when executing shell command with or without Ruby? 2010-12-30

    A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) command from the local computer. Basically like this: git clone [email protected]:TheUser/TheProject.git -key "/home/christoffer/ssh_keys/the

  • executing shell command with | (pipe) using NSTask 2011-07-22

    I'm trying to execute this comamnd ps -ef | grep test using NSTask but I can't get the | grep test to be included in the NSTask: This is what I'm using currently to get the output of ps -ef into a string then I need to somehow get the pid of the proc

  • Executing linux commands with PHP 2009-02-02

    I'm trying to execute a linux command through a PHP command-line script, which is no problem using the exec command. The problem is, the command I am executing (mysqldump) outputs an error message if something is wrong (for example user/password is i

  • execute shell command with variable 2011-12-28

    To execute 'find' with some variables from txt file i made this but it doesn't work. is that wrong with execute statement? #/bin/bash while read line; do echo tmp_name: $line for ST in 'service.getFile("'$line; do find ./compact/ -type f -exec grep -

  • Execute shell command with variable with spaces 2011-02-15

    I get an error (Not a working copy) executing a svn command in a bash script. I want to read a file containing file names. These file names get processed in the script. Each file name is on a separate line. Because some paths contain spaces the scrip

  • php executing shell command gives random output in only in heavy use mode 2012-03-28

    Please help me with this issue that I am facing on production server. I launched an application that saves images in a directory only after checking that it does not already exist. To check if it already exists I used the following command find $file

  • Safe shell call with php 2013-05-27

    I have a little coding project. I want to manage my dedicated server (debian based) with a web interface. I want to manage for example my services, my game server etc.. I allready have scripts to control them with a ssh connection, but it comes to be

  • PHP exec() will not execute shell command when executed via browser 2009-02-11

    I have a certain PHP script that calls exec() to execute a command to convert a PDF to JPG. This command works fine in bash. To preempt your initial troubleshooting guesses, note the following: safe_mode = Off Permission on the directory containing t

  • How can I execute remote commands in PHP via ssh? 2011-01-13

    I am trying to execute remote commands from within a php script over ssh, and I want the output from the commands (stdout and stderr) be streamed to the originating host. I know in Perl and Ruby this is possible. I could not find any such examples in

  • Execute root commands via PHP 2011-12-16

    I have a CentOS 5.7 linux server and use php5.3.x. On a pfSense system, you can restart services-that required root permissions using a php web page. I'm trying to do something similar, I have written some php code to execute shell commands. For exam

  • Security of executing a command from php 2010-05-04

    I'm writing a web application in which i use several thirdy party commands calling them with the exec function in PHP (for example, I render Latex formulas through a command-line program). My question is: what are the security issues of executing ext

  • I want to execute shell commands from maven's pom.xml 2010-08-16

    I want to execute linux shell commands with maven. Here is what I tried: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <executions>

  • CTS_ERROR >>> Failed to execute shell command am instrument 2010-11-29

    Using the Android 2.2, API-8, SDK-r7 along with CTS-2.2_r4 suite. Updated the SDK_ROOT environment variable with SDK_r7 tools in “android-cts/tools/startcts” script and the “SDK_ROOT/tools” also included in PATH environment variable. Ran the “android

  • Executing linux commands with c 2011-03-04

    Is there any way to execute Linux commands with c without using execlp(), like predefined functions or something else. Thanks. --------------Solutions------------- Use system() or popen() if you need the commands output. system(const char *command);

  • Executing shell command from ruby console returning Permission Denied Error? 2011-03-28

    Getting permission denied error while executing shell command from ruby console. And the same shell command is working from shell. From Shell.. [email protected]:~$ "`grep '^datadir=' /etc/mysql/my.cnf | cut -f 2 -d '='`/db_backups" bash: /db_b

  • How to execute shell command in C? 2011-05-12

    I am having problems executing the shell commands in C. I want to execute a shell command in C then capture the output of shell command and process the output further. I used following code to perform the functionality. But, the issue is when the she

  • How to execute shell commands in android? 2011-07-31

    I am trying to execute shell command through my code for adding entry in Iptables. The following is my piece of code private void createShellCommand(String uidValue_param, String interface_param) { // TODO Auto-generated method stub StringBuilder cmd

  • Execute shell command in c++ 2011-08-29

    I have a question regarding executing shell commands in c++. I'm building an application in winforms, vs 2008. My application has a button, when clicked should decode a binary file to a .csv file. I can decode files by first going to the right direct

  • shell command with VBA 2013-09-10

    I'm creating a new macro. So far, I have some code and it works. Then I have a shell command to run a macro in an Access database. Once the macro is completed, I want to run some more code to extract and format the results of the Access macro. Everyt

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.130 (s). 12 q(s)