How to setup auto daily restart centos 7?

Discussion in 'Systems Administration' started by MatthewKai, Jun 3, 2017.

  1. Hello Im using centos 7 so how do i go about setting up a daily server restart?
     
  2. It depends on what you are using to run your servers.

    You could use a bash script coupled with a plugin or can use one of those server monitoring softwares.
     
    • Agree Agree x 1
  3. Why in the hell would you want to restart CentOS? Server distros like that are built to run for litterally years at a time, if you are wanting to setup auto restarts of the minecraft server, there are plenty of plugins out that that can do that, I suggest googling :D
     
  4. i mean restart my minecraft server using centos 7 not restart centos 7 itself
     
  5. Off the top of my head can't you run a cronjob to start and stop the server every 24 hours?
     
    • Agree Agree x 1
  6. Just use an auto restart plugin, it'll be a lot easier than using cron. If you really want to though, here's something from the top of my head:
    Code (Text):
    00 00 * * * root screen -X -S hub1 quit
    00 00 * * * root screen -dmS hub1 sh java -jar /home/mc/hub1/spigot.jar
    Obviously this probably isn't exact and you'll need to tweak it anyway. And you gotta be using screen for this