My first question on stackoverflow!  I'm trying to figure out how I can start an external program that requires the user to interact with it, say vi, nano, ssh, telnet etc. and return to the Python script when the program exits.  I don't want to use send/expect or automate the external program at all, just start it, use it as normal and then return to the script.  I guess bash seems like a more natural way to do this, but I was hoping to get it done in Python.
2579
How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?
115615
I want to execute a script, start.sh on a remote server which runs this:  nohup node server.js &amp;   Naively, I call SSH like this:  ssh myserver &lt;&lt;EOF ./start.sh &amp; EOF   This starts the script, but leaves the session connected. I want to follow this step with other commands in a script, so that's no good.  How can I SSH to the remote machine, launch a nohup command into the background, then disconnect? I suppose I could put the SSH process itself into the background, but that doesn't seem right.
17256
I could (1) prepare a file with typed commands separated by end-line, (2) make it executable, (3) run it from a file-system manager or the terminal.  But this is ridiculous for not repeatable and every-time-other sets of commands.  Can I type those commands to the terminal in one request instead?  I don't know end-line character for the terminal - Ctrl, Shift or Alt with Enter doesn't work. &nbsp;
80321
I've got a Perl script that needs to execute another Perl script. This second script can be executed directly on the command line, but I need to execute it from within my first program. I'll need to pass it a few parameters that would normally be passed in when it's run standalone (the first script runs periodically, and executes the second script under a certain set of system conditions).  Preliminary Google searches suggest using backticks or a system() call. Are there any other ways to run it? (I'm guessing yes, since it's Perl we're talking about :P ) Which method is preferred if I need to capture output from the invoked program (and, if possible, pipe that output as it executes to stdout as though the second program were invoked directly)?  (Edit: oh, now SO suggests some related questions.  is close, but not exactly the same as what I'm asking. The second program will likely take an hour or more to run (lots of I/O), so I'm not sure a one-off invocation is the right fit for this.)
70604
Let's say we have a Python script my_script.py that does some data processing with Blender. This script accepts some arguments (e.g. arg1 arg2). How can I forward arguments to the script when using it with the CLI?  blender --background --python my_script.py   The only trick I could find was :  echo "arg1 arg2" &gt; my_input.txt &amp;&amp; blender --background --python my_script.py   Is this really the only way to do that?  Update  I found a  on Stack Overflow.
1878
How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line?
46113
I am new to shell scripts and many books have written that use #!(sha-bang) line in starting of the script to invoke the interpreter .And this will invoke a new shell for script and do the interpretation line by line.But one of my basic script is still running without the magic line.  so my questions are:   from where did my basic script get the interpreter. how did the script manages to locate the interpreter.   now let me tell you about my basic script it just contains the following line:  echo "basic script without the magic lines"
118805
I am running Debian 7 Wheezy and I need to start some screens on startup as soon as there is a fully functional internet connection. However, not, if the internet connection broke and was connected again. So only on the first functional internet connection after boot.  Could you please post a dummy script for this and tell me where to put it and make it be executed under the given conditions?  The script only needs to start the screen and then terminate but the screen should continue.    EDIT I have already heard of the /etc/network/if-up.d/ folder. But how can I make sure that the script is not executed again if the internet connection is lost and then re-established?
97701
I have a Python script I recently wrote that I call using the command line with some options. I now want a very thin web interface to call this script locally on my Mac.  I don't want to go through the minor trouble of installing mod_python or mod_wsgi on my Mac, so I was just going to do a system() or popen() from PHP to call the Python script.  Any better ideas? Thanks in advance!
107108
I am trying to achieve a scenario where I need to  SSH to ABC server from XYZ server. Public keys will set up already to smooth password less login. Now i just want to exit from script if found that  SSH command prompts for password. It means  public key are not set up.  ssh -o ConnectTimeout=10 user@ABC &lt;&lt;HERE ----- doing some stuff here---- HERE   Ouput-  Password:   Script resides on XYZ. I am running it from XYZ and trying to SSH ABC. If it prompts for password then exit from script by printing a message.
71653
I'm trying to start an external application through system() - for example, system("ls"). I would like to capture its output as it happens so I can send it to another function for further processing. What's the best way to do that in C/C++?
51057
It's sunday and I left an instance of R running in the office. The script finished running, and I would like to save my workspace without going to the office. I can ssh to the computer, but I have not run the program into screen.  Is there a way, over ssh, to disown the process (I don't have access to jobsid of the terminal the program is running on!) and reattach it with say, reptyr? Reptyr and reptyr -T don't work without previously disowning the process  28845 3diag       20   0  139.3m  10.4m   0.0  0.1   0:12.06 S  `- urxvtd                                                                                        5327 3diag       20   0   16.4m   4.6m   0.0  0.1   0:00.02 S      `- bash                                                                                      5335 3diag       20   0 3499.3m 3.244g   0.0 43.3 171:57.89 S          `- R    The unique part of my question is that I explicitly require to detach a program without having access to the terminal in which it was created.
97404
I have three scripts I need to run when I start up my Ubuntu machine, they start services I use in my development environment.  To do that, I manually open three terminals and type in the commands.  Is there any way to create a script that will open three terminals and execute one command in each of these? (Each command should be in a separate terminal window so I can see their output).
118991
I am running jmeter by launching the .sh script, once I do that I cannot start using the prompt again unless I ctrl-z, ctrl-c, or the script ends in some other way.  How can I launch that script and still be able to use the same console after the script is launched.  (i used to know how to do this, it's easy =()  I guess another way of putting it is how do I launch the script independently of the terminal.
26653
I know that shell scripts just run commands as if they were executed in at the command prompt.  I'd like to be able to run shell scripts as if they were functions... That is, taking an input value or string into the script.  How do I approach doing this?
113632
I wanted a daemon to start on boot so I added a line to /etc/rc.local that ended in "&amp;"  I did that so it would run in the background.  The daemon is loaded and working fine but when the daemon is running you can press keys that do other important things.  When I am finally logged in I wanted to resume process or send it a terminal (tty2) so I can do a couple of things.  I'm new to linux and not sure how to do this.  I do a ps -aux |grep uox to work out which PID it is. But not sure how to resume.
16261
How do I run a program in the background of a shell, with the ability to close the shell while leaving the program running? Lets say my UI is having problems or for some reason, I need to boot up a program from the terminal window, say, nm-applet:  nm-applet   When it's started, it occupies the foreground of the terminal window.  Is there any simple way to run the program in the background without needing to leave the terminal open or have it occupy the whole terminal?  On that note, I did find a way to run programs from the terminal and have it allow for other inputs, by appending an ampersand (&amp;) to the command as such:  nm-applet &amp;   But this isn't much use as any processes started in the terminal are killed once the terminal is closed.