bladerunner agent script TODO: - maybe... better log handling (?) - maybe... "other way" of child process handling (?) - job history - joblog transfer via XML - maybe user switch BUGS ?: - Parallel::ForkManager - script uses main loop (never ends), so the last child process will stay on system as but it will not make any problems YAML config file: # agent host / port and the rest agent: host: 127.0.0.1 // agent host IP port: 1234 // port max_clients: 10 // max HTTP clients at one time cmds: clist, slist, jlist, ping, run, kill // allowed commands htpasswd_file: /etc/brad/htpasswd // file with password - htpasswd format ssl_cert_file: /etc/brad/ssl/ssl.crt // ssl cert ssl_key_file: /etc/brad/ssl/ssl.key // ssl key jobs_file: /etc/brad/_running // file with currently running jobs # scripts n logs scripts: dir: /home/brad/scripts // directory with scripts logs: /home/brad/logs // directory for logs commands: clist - list available commands slist - list all of scripts in directory jlist - list currently running jobs/scripts/commands whatever... ping - pong ;-) run - run the script kill - kill the job examples: / clist / wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=clist" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:10:09 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:10:09 GMT Server: libwww-perl-daemon/5.827 Content-Length: 230 Content-Type: text/xml 1374315009clistslistjlistpingrunkill / slist / wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=slist" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:12:25 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:12:25 GMT Server: libwww-perl-daemon/5.827 Content-Length: 770 Content-Type: text/xml 1374315145 / jlist / *** no jobs running wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=jlist" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:13:45 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:13:45 GMT Server: libwww-perl-daemon/5.827 Content-Length: 143 Content-Type: text/xml 1374315225notr *** jobs running wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=jlist" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:15:46 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:15:46 GMT Server: libwww-perl-daemon/5.827 Content-Length: 398 Content-Type: text/xml 137431534678041374315339127.0.0.11374315339.7804.log78101374315344127.0.0.11374315344.7810.log / ping / wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=ping" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:08:44 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:08:44 GMT Server: libwww-perl-daemon/5.827 Content-Length: 141 Content-Type: text/xml 1374314924ok / run / wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=run&arg1=time1.sh" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:20:59 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:20:59 GMT Server: libwww-perl-daemon/5.827 Content-Length: 143 Content-Type: text/xml 13743156597985 / kill / wget -q -S -O- --no-check-certificate --user=user1 --password=pass1 --post-data "cmd=kill&arg1=8132" https://127.0.0.1:1234/ HTTP/1.1 401 Authorization Required Date: Sat, 20 Jul 2013 10:29:01 GMT Server: libwww-perl-daemon/5.827 Connection: close WWW-Authenticate: Basic realm="authorization required" HTTP/1.1 200 OK Date: Sat, 20 Jul 2013 10:29:01 GMT Server: libwww-perl-daemon/5.827 Content-Length: 141 Content-Type: text/xml 1374316141ok There are couple things to do, but it can work. This was supposed to be part of bigger software (agent.pl on the remote host, and GUI program on the PC .. maybe some server software between) but I think it will never happen.