![]() |
What is the & for in nfsnetclient &
In the text file UsingCommandLine.txt it gives an example
of a the command to to start the nfsnet program and has an & after the program name. What is the & for ? Is it needed ? I don't always use it and the program works, I haven't noticed any difference with or without it. Or is it just a stray character ? --==from the text file==-- ======================================= Stopping and Starting the NFSNET Client ======================================= You start the siever client with the command ./nfsnetclient & and stop it by creating the file called stop.txt in the NFSNET/processors/p0/ folder. --==from the text file==-- |
The "&" puts the program into the background so you get the prompt back...
I like to run with... nohup ./program & Which keeps the program alive even if you log out accidently... You can also start the program without the "&", and if you are using the Bash shell hit CTRL+Z to suspend it and then "bg" to move it into the background... To bring it back to the foreground type "fg"... |
Re: What is the & for in nfsnetclient &
[quote="dsouza123"]
What is the & for ? Is it needed ? [/quote] You should read the manual about the shell (csh, bash, etc.) Normally, when a command is started, the shell "hangs" while it waits for the command to execute. (Synchronous execution) When the comand completes, you get the next command prompt. The "&" tells the shell to run the command asynchronously. The shell starts the command and then immediately returns to give you the next prompt for another command. Such asynchronous execution is appropriate because the siever runs for a very long time and you might wish to use the shell while if is running. In particular, you should not kill the siever with Ctrl-C (or equivalent) but rather by creating the "stop.txt" file. Having the shell ready and waiting is appropriate. |
Under Win98SE it doesn't seem to make a difference.
I usually start a windowed DOS prompt. Go to C:\NFSNET nfsnetclient it takes over the DOS prompt until stop.txt is created. The nfsnetclient.exe always starts a second program linesiever.exe so there are 3 programs running WINOA386.MOD the name for the DOS prompt NFSNETCLIENT.EXE LINESIEVER.EXE Only the linesiever uses any significant amount of CPU time. It's priority seems the same either way process idle 4, thread idle 1 If the DOS prompt is minimized it doesn't affect it. linesiever and nfsnetclient are 32 bit windows console programs. I'll have to try the other way using the desktop shortcut to the nfsnetclient.exe to see if the priority changes or if there is any other discernable difference. nohup doesn't seem to be part of W98SE maybe it is a port of a *NIX utility in other versions of windows. Just like the touch mentioned in UsingCommandLine.txt touch ./processors/p0/stop.txt I wrote a 2K program in Delphi ( NFS_STOPNOW ) to create the stop.txt file. Wrote another one ( NFS_ALLOW ) to delete it. And a third in MASM ( NFS_STOPDONE ) to create the stop.txt immediately after it completes the assignment, but before it can request a new one. |
Yes, "&", "nohup" and "touch" are Unix commands...
If you want them on Windows, visit here... http://www.cygwin.com/ |
| All times are UTC. The time now is 23:55. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.