'How to send a cmd to a screen session

I am creating an game server (Don’t_Starve_Together_Dedicated_Servers) , I want to periodically send a message to the game client,the game server privide an api is 'c_announce("the message here").

And now I use screen -S master to create a new session, and run the main progame enter image description here

At this time it will wait for my input, if at this point I enter the information and it will success, and then I use ctrl+A d to Detached this session.

And I add */5 * * * * steam screen -X master c_announce("hello") to /etc/crontab to create scheduled task,but the cmd is wrong.

Actually, the cmd screen -X master c_announce("hello") doesn't work. There is no message send in game client.And I tried using echo 'c_announce("hello") > screen -r masterecho 'c_announce("hello") > screen -X master,but they are all no responce.

Poor english, please forgive me. thanks for answer!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source