I've been searching to try to find the information I need, but I have so far been unsuccessful.
What I would like to have happen daily is the following:
- Every time the machine starts, the Minecraft server is started. (I have the shell commands already written for this.)
- At 8:00 AM, the text "stop" is submitted to the server to cause it to gracefully stop.
- At 8:02 AM, the computer restarts.
Ideally, this will open a window on my desktop that enter commands into, and also have a way to send commands to the server through a remote terminal.
How do I do this? I have found information on using
sudo crontab -e in order to allow super-user access needed to run the Minecraft server. I have also looked into using named pipes, but I can't quite get it working right. I can create it with
mkfifo mcserver, but it blocks unless I open the pipe in another terminal. I have also looked into
screen, as well as
echoing commands to a directory based on the pid, but I have not been able to get that to work either. How would I detect and store the pid?
Thank you for your help. It's greatly appreciated. I've been struggling with this for quite a while, and I just can't seem to figure it out.