Results 1 to 2 of 2

Thread: Script to restart a terminal command in xterm if a server stops running.

  1. #1
    Join Date
    May 2008
    Beans
    6

    Script to restart a terminal command in xterm if a server stops running.

    So, basically, what I want to do is execute this command and make it so that, if the server shuts down, that it automatically runs the command again.

    Code:
     sudo xterm -hold -e sudo minetest --server --worldname public1
    Any ideas? Do I need to make a .sh file that loops itself or something like that? Thank you.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Script to restart a terminal command in xterm if a server stops running.

    If you need to run a daemon, it would be best to use the built-in OS methods for doing this. Examples are in /etc/init.d/ Then setup a watch/monitor that checks if it is still running or not, then restarts it.

    This shows how to do it with "upstart":
    https://askubuntu.com/questions/2515...tart-a-process
    Please don't use this for GUI stuff. That is bad - what happens when nobody is logged in and there isn't any X/Windows server running? It will be bad.

    There is also the inittab - I'm not seeing that on a box here - ah - because upstart replaces it. That means that systemd will replace upstart and need a new way.
    Last edited by TheFu; September 24th, 2015 at 12:11 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •