I am developing a php script that runs on a apache Linux system. It should execute several commands for me. Depending on which command I executed in the my custom php GUI.
Until now I was able to successfully implement this with various shell_exec commands. Now I want to run the following command via php exec script on the Linux system.
AdminTool $IP $USER $PASSWORD shell
Usually when i enter this command on the Linux System itself it opens a connection and runs a shell which is provided by the hardware manufacturer.
Now i want to run this shell using php exec and run the next command within this manufacturer shell. Depends on what I have selected via my custom php GUI.
The shell provides different commands within.
Does anyone know if this can work? And if yes how?
The shell is just a command line interpreter. Commands are (most of them) names of programs executables and by calling them (using the command) you tell the shell to check if the executable exists in an predefined path (environment paths) and if it does to execute the program.
I am just guessing but the thing that you run with AdminTool $IP $USER $PASSWORD shell is a program which runs in a command line interface if the parameter "shell" is provided.
You can not use php exec with the command line interface of the program. Your options are:
You can do the tasks you need to do with the program by passing command parameters e.g.
AdminTools $ip $user $password dotaskone AdminTools $ip $user $password dotasktwo But looking at the first three parameters you pass I think you make a connection to server. Deppending on the complexity of the things you do with that program (if it is built to take paramaters as commands), that means a lot of program executions - therefore a lot of connections to that server it connects to.