I want to have a functionality in which i will create an go program running on linux system. When that program is running it will download a zip folder from server & extract it to user HOME directory. That extracted folder will have a shell script file eg. Update.sh.
Now i want once that file is extracted i want to open the terminal & run the shell script automatically which resides inside extracted folder. Kindly gudie me can i do that ?
Have you looked at the Go standard library? Your best bet is os/exec. I don't know how feasible it would be to open another terminal and launch the script in it, but you can pipe the output of the command launched by os/exec to the stdout of the terminal in which the go program was launched.
From your question, it sounds like the go program downloading and running the script is already being run by the user on the local machine. If this is not the case, then the above will not work.
Related
I am new to Linux. I have a simple .sh file that help me to run an application from a directory.
#!/bin/bash
/home/nick/TestApp/app.x86_64
when I run the .sh file, I can observed that the console app is running in the background from System Monitor. However, there is no terminal showing up and I could not see the output of the program. How do I get it to work like it was executed from a terminal manually? I want to see the output.
P.S. I am running the .sh from Desktop with double click.
Quick background: I previously used a remote Linux server for a project. Here I was able to pull up the Linux command window in the directory where files from another program were located, and enter a command such as lspp c= example_file.cfile -nographics. LSPP in this case is short for LS PrePost - through this command I was able to call LSPP in the background and have it reference the given *.cfile which contains various commands to be executed, such as depositing a given *.csv file with results, its name, etc.
I recently managed to install LSPP for windows locally, and am now trying to essentially translate the functionality of the command I executed in Linux, to Windows. I should add that I have no experience with CMD or Windows PowerShell...
The first thing I tried was to use cd C:\.... to set the directory to where the *.cfile is located and then enter the same lspp c= example_file.cfile -nographics from Linux, however, the response was that "lspp" was either spelled wrong or could not be found.
Next I tried setting the directory to the LSPP program folder, and using start LS-PrePost-4.7-x64 to at least start the program, but this didn't work either.
I would really appreciate it if someone could point me in the right direction here - thank you!
Im trying to execute a .AIR file on a linux box (ubuntu) from the command line, and disregard the GUI.
Here's the thing. About 6mo I was able to do this, but I forgot how I did it, and I'm left to figure out how it was done by looking at clues on the server.
I see the MainSimple.air file that I had originally used.
I see that I somehow installed it into /opt/MainSimple/bin/MainSimple (which is now a binary file, not an air)
I see my script file to run that file, and it successfully executes.
--- runAir.sh ---
#!/bin/sh
export DISPLAY=:2
/opt/MainSimple/bin/MainSimple &
So my question is, now that I have a new/different air file... how do I get it to "install" or change/compile into a binary file like I did before?
I know an .air file is just a zip file.. I unzipped it, and theirs no /bin directory in it.
To install an air application from command-line, you can try this:
ln -s "/opt/Adobe AIR/Versions/1.0/Adobe AIR Application Installer" /usr/sbin/airinstall
The above command will create a symbolic link for Air Application Installer. Then, to install an air app:
airinstall app.air
To execute/run the air application, locate the binary file of your air application then run it on terminal:
/opt/MainSimple/bin/MainSimple &
I have a question on how to make process work around in C#.
Suppose I write a program or an executable A.exe, which needs to run in another terminal Environment other than cmd. Manually, I could start that terminal, and then locate my A.exe, then execute. But if we want to write program to automatically start that terminal and ran A.exe, how could we do that.
To be more specific, A.exe may need tools or have dependencies provided by the other terminal. That's why we need to open that terminal first, and inside that terminal environment to run A.exe.
Any suggestions on how to write programs or batch to open that terminal and run A.exe in that terminal? Or there is any other way to implement?
Thanks much!
you may just start both the .BAT setting the appropiate environment and then your program in a single .BAT file
CALL ENV.BAT
A.EXE
I have a shell script, called startmq.sh, to run activeMQ. However I changed the script, it did not refresh the changes at all.
Even I only wrote echo "Hello World", it did not refresh and was trying to run activeMQ with wrong parameters.
Then, I copy startmq.sh to abc.sh and tried to run abc.sh. It showed Hello World.
Plus, I need to use that standard name startmq.sh.
Thanks.
can it be, that you have this script multiple on the server?
under bash do the following whereis shows you the locations of the script(s) and which shows you witch script ist starting ...
bash:# whereis startmq.sh
bash:# which startmq.sh
There must be another copy of startmq.sh somewhere accessible due to its path being amongst the PATH enviroment variable.