Commit d7827f22 authored by Evan Hunt's avatar Evan Hunt
Browse files

Added sendcmd.py, which sends a specified command to a specified channel


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@268 e5f2f494-b856-4b98-b285-d166d9295462
parent d1ce6d68
......@@ -87,7 +87,7 @@ main(int argc, char* argv[]) {
int n = select(nfds, &fds, NULL, NULL, NULL);
if (n < 0)
throw FatalError("select error");
if (FD_ISSET(ps, &fds))
plot.processMessage();
......
......@@ -21,8 +21,14 @@
class ZoneSet : std::set<std::string> {
public:
void serve(std::string s) { this->insert(s); }
void forget(std::string s) { this->erase(s); }
void serve(std::string s) {
std::cout << "now serving: " << s << std::endl;
this->insert(s);
}
void forget(std::string s) {
std::cout << "no longer serving: " << s << std::endl;
this->erase(s);
}
bool contains(std::string s) {
return (this->find(s) != this->end());
}
......
#!/usr/bin/python3
import ISC, sys
cc = ISC.CC.Session()
if len(sys.argv) < 3:
sys.stderr.write('Usage: ' + sys.argv[0] + ' <channel> <command> [arg]\n')
sys.exit(1)
channel = sys.argv[1]
command = sys.argv[2]
if len(sys.argv) >= 4:
argument = sys.argv[3]
else:
argument = ""
cmd = { "command": [ command, argument ] }
cc.group_subscribe(channel)
print("Sending:")
print(cmd)
cc.group_sendmsg(cmd, channel)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment