nohup is not recognized as internal or external command - windows

I am trying to run an python script using nohup
I have used the following command
nohup python filename.py &
it shows the following error
nohup is not recognized as internal or external command
can anyone tell me why?

On Windows OS, use:
start /min python filename.py &
On Windows, killing a parent process does not dictate that a child process be terminated. Therefore there is no direct nohup equallent.

Related

Start jobs in background from sh file in gitbash

I need to start a couple of processes locally in multiple command-prompt windows, to make it simple, I have written a shell script say abc.sh to run in git-bash which has below commands:
cd "<target_dir1>"
<my_command1> &>> output.log &
cd "<target_dir2>"
<my_command2> &>> output.log &
when I run these commands in git bash I get jobs running in the background, which can be seen using jobs and kill command, however when I run them through abc.sh, I get my processes running in the background, but the git-bash instance disowns them, now I can no longer see them using jobs.
how can I get them run through the abc.sh file and also able to see them in jobs list?

Windows Subsystem on Linux - Create new cmd-window instance with bash script

I'm using the Windows Subsystem on Linux (Ubuntu) and would like to be able to run multiple processes in parallel from my bash script by creating multiple cmd-window instances of the Ubuntu shell. Is this possible?
I tried using gnome-terminal to run multiple commands via:
gnome-terminal -e "command"
But it returned the error:
Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error spawning command line 'dbus-launch --autolaunch= --binary-syntax --close-stderr': Child process exited with code 1
And it seemed like people were having trouble using gnome-terminal.
Any ideas for accomplishing this? Thanks.
For Windows 14393 and above:
cmd.exe /c start bash.exe -c ls

how to mark "executed command" for custom script extension in shell script given

How to mark a configured shell script to executed command in Azure VM Custom Script Extension ?
It is running the shell commands in configured CSE but it has not ending up the script due to one of my command. My command will be running a small HTTP listener kind of server.
If make "exit 0" will mark CSE as command executed and so it will exits in my powershell script where i encountered this CSE.
If my understanding is right. You could run HTTP listener in the background and exit your script. Just use below:
nohup <bash shell> &
man nohup
nohup - run a command immune to hangups, with output to a non-tty
& to the command line to run in the background:

How to start composer-rest-server as background process?

I am trying to start composer-rest-server in background using following command :
composer-rest-server &
Its getting started as background process, but then process is getting stuck after displaying "hyperledger-Composer" banner as :
Is there anyway we can start composer-rest-server as background process?
Run command like this:
nohup composer-rest-server -c <network card name> -n never -w true > rest-server.out 2> rest-server.err < /dev/null &
all standard output will be saved in rest-server.out and errors in rest-server.err
& at the end will put it in background and you will get PID
Next time you connect to server and if you want to kill earlier instance then use ps -A | grep "node" command to get PID.
If you run it with no arguments it will prompt for arguments (reading from the keyboard). You should launch it with arguments. If you run it with no arguments from a terminal, answering all the questions, at the end it will print the command line you can use to launch it with the answers suppplied using command line arguments.
You should be able to use that command line with nohup or screen or similar.

What's the nohup on Windows?

I want to run a Java jar file like this:
java -jar spider.jar
How to run it on the background on Windows?
Like this on Linux:
nohup java -jar spider.jar > /var/tmp/spider.log 2>&1 &
You could use the Windows start command:
start /min java -jar spider.jar
This command is not really the same as nohup; but it might be suitable if you're happy with the Java process running in a separate minimised window. See http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
On Windows it's not normal that a process terminates once its parent was killed (like Unix-likes do it normally). Therefore there is no direct necessity for something like nohup. If you want to avoid the console window associated with it, you can use javaw but redirection won't work, then.
The only way to get the nohup behavior, where the process still runs after logging off (like for micro-services, analytic tools, server batch jobs etc.), is to run the .bat file with the start javaw -jar ... contents as either a service or a scheduled task.
save the following code to nohup.vbs, and add the directory to PATH.
Set args=Wscript.Arguments
Set ws=CreateObject("wscript.shell")
ws.Run args(0),0,true
then, run:
nohup "java -jar spider.jar > /var/tmp/spider.log"
Note that you should quote the full commands and the redirects.
For windows run following mentioned command in Command Prompt or in Terminal
nohup (file need to run) > (File you need to save the log) 2>&1
Ex:
nohup ./bin/windows/kafka-server-start.bat config/server.properties > ./MyKafka.log 2>&1

Resources