Menu

#275 Force Starting Multicast (with example code)

open
nobody
None
5
2011-08-09
2011-08-09
Cam
No

Sometimes we have computers who are dead, but we only discover it after we have queued them for a multicast
So then we have to sit around and wait for the UDPCAST time-out

I managed to get multicast to start on command from the web UI

in /opt/fog/service/common/lib/MulticastTask.class.php

at around lines 157, 167 and 210

define this
$inputpath = "/opt/fog/input/mcastin.".$this->intID; //the path can be anywhere

replace the lines
$cmd .= "gunzip -c \"" . $path . "\" | " . UPDSENDERPATH . " --min-receivers " . $this->getClientCount() . " --portbase " . $this->getPortBase() . " " . $interface . " $wait --half-duplex --ttl 32 --nokbd;";

with
$cmd .= "echo -n > ".$inputpath." ; chmod 766 ".$inputpath." ; tail -f ".$inputpath." | " . UPDSENDERPATH . " --file ".$path." --pipe \" gunzip -c \" --min-receivers " . $this->getClientCount() . " --portbase " . $this->getPortBase() . " " . $interface . " $wait --half-duplex --ttl 32;";

What this does is free up the STDIN of udpcast, and instead sends keyboard commands though it, which are piped out from tail
note that the --nokbd parameter have been removed, this means that any data written into $inputpath will be considered a keystroke and udpcast will begin regardless if every client is ready

so then we just write any data into $inputpath using the php interface

the --pipe parameter should be moved to the client side as well

Discussion


Log in to post a comment.

MongoDB Logo MongoDB