keypress simulation needed to complete process automation
Hey y'all. I wrote a daemon script to launch a second script that is responsible for monitoring/controlling a UI program. The problem is that if i run the daemon script on the command line like so: sh /path/to/daemon_script.sh, the monitor script causes the UI to not work correctly. Now if I run the contents of the daemon script manually on the command line like so: screen watch -n 60 /path/to/monitor_script.sh it works properly and runs every 60 seconds like it is supposed to. So, I am going to make a c program to see if it will work that way. I plan on using execl calls or something similar. Now here is where the problem lies; In order for the process to become daemonized, I need to manually hit control + A and control + D. That is what the screen command is for. Is there a way to simulate these key presses with C? I'll even settle for python, but would prefer C since that is what my entire program is based off of.
Even a better way to do this would be cool. Suggestions, ideas?