Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import commands
  4. import os
  5. from sys import exit
  6.  
  7. # exit()
  8.  
  9. config = {
  10. 'Mythrios' : 'Mythrios', # Name of the wow server (Prefix for the screen session)
  11. 'root' : 'root', # User that should run the server processes
  12. }
  13.  
  14. # List of processes that should be checked periodically
  15. daemons = {
  16. 'logon' : '/opt/mangos1/mangos-realmd',
  17. 'realmname' : '/opt/mangos1/mangos-worldd'
  18. }
  19.  
  20. for name, path in daemons.iteritems():
  21. if not path in commands.getoutput('ps -Af'):
  22. os.chdir(os.path.dirname(path))
  23. os.system('screen -A -m -d -S ' + config['servername'] + '_' + name + ' sudo -u ' + config['user'] + ' ' + path)
  24. print '[Restarteur] Lancement ' + name
  25. else:
  26. print '[Restarteur]', name, 'Est deja lancer'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement