CLI mode

Skynet also works in CLI mode with different interface.
To launch Skynet in CLI mode just launch:

php skynet.php

In CLI mode, Skynet starts with status "0" (Idle), no connections are launched at start, you must execute connection manually by specified command.

All commands must be prefixed by "-" char. You can join commands in one line.
Arguments for commands should be quoted by " chars, e.g.:

php skynet.php -command "argument"

or
php skynet.php -command "argument1" "argument2" "argument3"...

This version of Skynet serves you some commands to use:

-debug
Displays connection data

-dbg
Displays connection data (shorten alias for command "-debug")

-cfg
Displays configuration

-status
Displays cluster status (KEY, chain value, etc.)

-out [field] or [field1, field2...]
or
-out [field] [field2] [field3]
Displays only specified fields returned from response, example:
php skynet.php -broadcast -out "foo"

Example above will display only value of field "foo" from response at output.
You can use this to integration with another apps like CRON, and specify here defined output data.
You can specify more than one field - just seperate them by coma, example:
php skynet.php -b -out "foo1, foo2, foo3"
or:
php skynet.php -b -out "foo1" "foo2" "foo3"

It will display values from fields foo1, foo2 and foo3 returned from response


-connect [address]
Connects to single specified address, example:
php skynet.php -connect "http://localhost/skynet/skynet.php"

It will connect to cluster with address http://localhost/skynet/skynet.php

-c [address]
Connects to single specified address (shorten alias for command "-connect"), example:
php skynet.php -c "http://localhost/skynet/skynet.php"

It is the same like "-connect" command.

-broadcast
Broadcasts all addresses (starts Skynet)
It will connect to all clusters stored in database (status "2" - Broadcast).
At default, no output data will be displayed. If you want display connection debug data - use command "-debug" or "-dbg", example:
php skynet.php -broadcast -debug

-b
Broadcasts all addresses (starts Skynet) (shorten alias for command "-broadcast")

-send ["request params"]
Sends request from command line, syntax of request params is the same like in webconsole expects quotes.
Syntax is similar to webconsole expects quoting and separating commands/params by new line - in CLI mode all " (quote) chars must be replaced by ' char (apostrofe), example:
php skynet.php -broadcast -send "foo:'bar'"

It will connect to all clusters and send request with two parameter: foo.
Commands and parameters in "-send" command must be splitted by semicolon and space after semicolon: "; ", example:
php skynet.php -broadcast -send "foo:'bar'; foo2:'bar2'"

It will send two parameters: foo and foo2 by request.
Remember about space after semicolon, example below:
php skynet.php -broadcast -send "foo:'bar';foo2:'bar2'"

Will send only one parameter: foo with value "bar;foo2:bar2"


-db [table name] optional: [page] [sortByColumn] [ASC|DESC]
Displays logs records from specified table in database, example:
php skynet.php -db "skynet_clusters"

It will display records from table skynet_clusters
Example 2:
php skynet.php -db "skynet_clusters" 2 id asc

It will display page 2 of records from table skynet_clusters sorted by id column in ascending order.

-db [table name] -del [record ID]
Erases record from database table, example:
php skynet.php -db "skynet_clusters" -del 5

It will erase record with id = 5 from table skynet_clusters

-db [table name] -truncate
Erases ALL RECORDS from database table, example:
php skynet.php -db "skynet_clusters" -truncate

It will erase all records from table skynet_clusters

-sleep
Sleeps this cluster.
It sets option sleep to "1"

-wakeup
Wakeups this cluster
It sets option sleep to "0"

-help
Displays help

-h
Displays help (shorten alias for command "-help")

-check
Checks for newest version info on GitHub

-pwdgen [your password]
Generates new password hash from plain password, example:
php skynet.php -pwdgen "foo"

It will generate and display hash for password "foo".
Generated hash should be placed in constant PASSWORD in your config file.

-keygen
Generates new SKYNET ID KEY
Generated key should be placed in constant KEY_ID in your config file.

-compile
Compiles sources from /src into standalone (by default: source dir is "/src", example:
php skynet.php -compile

It will compile all files from /src directory into /compiled/123456_skynet.php standalone cluster where 123456 is actual time in linux format.
Full API Documentation is included in Skynet packages available on GitHub.