Hi,
Quote:
Originally Posted by bcnx
It should be in background because the script will not continue otherwise until this process is stopped in foreground. And the next step is to tell the remote server to start dumping to the netcat listener. This will not happen as long as the listener is not pushed to the background.
|
There is no foreground and/or background when you execute from cron, like I said before: The jobs run from cron are not connected to a terminal (simply said: they already run in the background).
Quote:
So you are basically telling this is not possible because we run from cron?
|
No I'm not.....
If you put the following line in your crontab:
10 * * * * netcat -l -p 7000 | dd of=imagefile the following will happen:
1) At ten past the hour crontab will launch the netcat command,
2) the netcat command will silently wait (execute a
ps -ef | grep netcat to see the process) until called upon.
When you run
dd if=imagefile | netcat <some.ip.number> 7000, the transfer is started and when finished all processes involved (on both machines) stop (re-run the ps -ef command shown earlier).
There's no need to push anything to the background.
The fetch command (dd if=imagefile | netcat <some.ip.number> 7000) can also be run from crontab on the other machine, just make sure it is started later then the first one.
Hope this helps.