Hey so I was wondering how can I make it so that in my sh script two commands execute at the same time without waiting for one another to finish. As an example I'd like zmap to run and a listener.pl
How could I do this? I know doing this will run zmap then after zmap is over it will run the 2nd command
but I need both to be executed at the same time.
#/bin/sh
zmap
perl listener.pl
Run the jobs in the background by appending & to each command.
#/bin/sh
zmap &
perl listener.pl &
wait
Related
Consider an command which has to be executed more than once at the same time, I have created a bat file in which Start command is used to execute the command multiple times at once. But there are couple of problem I am facing,
After starting all the commands the main batch file is closed. It is not waiting until the new command window has done its job.
We are not able to keep track of the progress in new windows, for example consider the commands are executed from team city(CI) then the progress is not tracked.
Please help me on this, Thanks in Advance!
1) - Use START "" /WAIT, than start command wait till started process terminate, than continue running batch file.
I've got this Perl script on Ubuntu that I need to run at a particular time in the future. I don't need it to run at that time more than once or basically what I'm trying to say is that it does not need a cron.
I need to schedule a run at a future time to run once and that's it. Any idea how to go about it? I've googled a bit but every time the concept of cron comes up so not really helpful.
I do have some code. The user clicks on a button (say "Schedule") on the GUI and a process starts in the background which schedules the run after (say) N hours.
I'm ready with the GUI and the connection to the backend Perl script. The N hours is predetermined. But I don't know how to code the scheduling concept in the Perl script.
One way is that your Perl scripting will just sleep(seconds) and then execute the action. In case you don't want to have this you need to tell some other service that it should invoke a program at a specific time. In UNIX this is usually done with the at command.
Use the at command:
echo 'perl foo.pl' | at now + 3 hours
I trying to figure out how a Perl script which is doing test status reporting, is working. The script executes another piece of perl script via exec. I am able single step through code in first script but when it hits exec, the script executed by exec runs till completion. Is there a way by which I will be able single step and look at variables in the script executed by exec?
Add below to the script which is being called with exec
#!/usr/bin/perl -d
Hopefully a quick question. I have a .sh script running a php script - the php takes some time to complete and I want the .sh script to proceed.
Is that possible? And if so, how so?
Have you tried php somescript.php & ? The & at the end causes the sh script to continue executing.
If you want the php script to outlive the shell script, try this:
nohup php somescript.php >/dev/null 2>&1 &
I have a perl script that I run from the command prompt: 3 times a day, the problem is now I need to run it every two hours. Im not going to be on an episode of lost so I need some help. Here is the command:
Perl C:/test/scripts/edi.pl
Does anyone know how this above one line command can be made into an executable (.exe) file so I can use the task scheduler to run?
If there is another way to do this with the task scheduler to run once every two hours every day then I could do that as well.
Thanks for your time.
Can you not simply create a batch file that runs the script, and set that batch file to run every two hours? I know from a quick test there that I can schedule a batch file to run from Task Scheduler on Windows XP at least.
You can actually use the task scheduler to run that exact command without a batch.
The task scheduler should allow you to pass some arguments to the script without a problem (I have done this on a few Windows servers in order to have them run PHP scripts)