jobs

How do I Start a job of a function i just defined?

心不动则不痛 提交于 2019-11-26 10:01:28
问题 How do I Start a job of a function i just defined? function FOO { write-host \"HEY\" } Start-Job -ScriptBlock { FOO } | Receive-Job Receive-Job: The term \'FOO\' is not recognized as the name of cmdlet, function ,script file or operable program. What do I do? Thanks. 回答1: As @Shay points out, FOO needs to be defined for the job. Another way to do this is to use the -InitializationScript parameter to prepare the session. For your example: $functions = { function FOO { write-host "HEY" } }

How do I use the nohup command without getting nohup.out?

谁说胖子不能爱 提交于 2019-11-26 07:49:58
问题 I have a problem with the nohup command. When I run my job, I have a lot of data. The output nohup.out becomes too large and my process slows down. How can I run this command without getting nohup.out? 回答1: nohup only writes to nohup.out if the output is otherwise to the terminal. If you redirect the output of the command somewhere else - including /dev/null - that's where it goes instead. nohup command >/dev/null 2>&1 # doesn't create nohup.out If you're using nohup , that probably means you