Created
January 19, 2018 09:40
-
-
Save steinkel/774d1d249f085580c91150b247cd6bfc to your computer and use it in GitHub Desktop.
create socket shell in ubuntu to feed a cakephp shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in /etc/systemd/system/cakesocket.socket | |
[Unit] | |
Description=Cakesocket example | |
[Socket] | |
ListenStream=8088 | |
Accept=yes | |
[Install] | |
WantedBy=sockets.target | |
in /etc/systemd/system/[email protected] | |
[Unit] | |
Description=Cakesocket service example | |
[Service] | |
ExecStart=-/usr/bin/php /tmp/app/bin/cake.php listener | |
StandardInput=socket | |
then bake a new app under /tmp/app | |
bin/cake bake shell listener | |
vi /tmp/app/src/Shell/ListenerShell.php | |
modify main method | |
public function main($data = null) | |
{ | |
$input = $this->in('?'); | |
echo $input; | |
} | |
then do | |
sudo systemctl daemon-reload && sudo systemctl enable cakesocket.socket && sudo systemctl start cakesocket.socket && sudo systemctl status cakesocket.socket | |
check status is OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment