Compare commits
3 Commits
873862424c
...
66b42612f9
Author | SHA1 | Date | |
---|---|---|---|
66b42612f9 | |||
29717432ae | |||
029380c75f |
54
scripts/module/del_zephir.zephir
Normal file
54
scripts/module/del_zephir.zephir
Normal file
@ -0,0 +1,54 @@
|
||||
from zephir.lib_zephir import *
|
||||
import os, shutil
|
||||
from creole.config import eoledirs, distrib_dir, dicos_dir
|
||||
from creole.client import CreoleClient, NotFoundError
|
||||
from pyeole.service import manage_service, unmanaged_service
|
||||
|
||||
|
||||
creole_client = CreoleClient()
|
||||
try:
|
||||
eole_module = creole_client.get_creole('eole_module')
|
||||
eole_version = creole_client.get_creole('eole_release')
|
||||
except Exception, exc:
|
||||
print_red("\nErreur d'accès au service creoled :\n\n")
|
||||
print str(exc)
|
||||
exit(1)
|
||||
|
||||
stats_running = False
|
||||
stats_service = u'z_stats'
|
||||
if os.path.isfile('/var/run/z_stats.pid'):
|
||||
stats_running = True
|
||||
try:
|
||||
from zephir.zephir_conf import zephir_conf
|
||||
except:
|
||||
zephir_conf = None
|
||||
|
||||
|
||||
if stats_running:
|
||||
manage_service(u'stop', stats_service)
|
||||
|
||||
if eole_module != 'zephir':
|
||||
if zephir_conf is not None:
|
||||
# agents de surveillance : on réinitialise le n° de l'agent à 0 pour les stats
|
||||
# si il existe déjà
|
||||
stats_dir = '%s/monitor/stats/' % zephir_dir
|
||||
# ancien répertoire de stockage
|
||||
old_id = str(zephir_conf.id_serveur)
|
||||
if os.path.isdir(stats_dir + old_id):
|
||||
shutil.move(stats_dir + old_id, stats_dir + '0')
|
||||
try:
|
||||
os.unlink("%s/zephir_conf/zephir_conf.py" % zephir_path)
|
||||
except:
|
||||
print("\n !! le fichier %s/zephir_conf/zephir_conf.py n'a pas pu être supprimé !!\n" % zephir_d_path)
|
||||
try:
|
||||
os.unlink("%s/zephir_conf/zephir_conf.pyc" % zephir_path)
|
||||
try:
|
||||
f=file("%s/deffered_logs" % zephir_dir, "w")
|
||||
f.close()
|
||||
shutil.rmtree("/var/spool/uucp/zephir")
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
if stats_running:
|
||||
manage_service(u'start', stats_service)
|
@ -23,7 +23,7 @@ from zephir.lib_zephir import flushed_input
|
||||
|
||||
def display_help():
|
||||
print("Sauvegarde une cle ssh d'un utilisateur dans Zephir")
|
||||
print("{} [utilisaeur] [--key chemin_de_la_clé]".format(sys.argv[0]))
|
||||
print("{} [utilisateur] [--key chemin_de_la_clé]".format(sys.argv[0]))
|
||||
|
||||
|
||||
def argparser():
|
||||
|
Loading…
Reference in New Issue
Block a user