Commit abfaf5f0 authored by Maiken's avatar Maiken
Browse files
parents 51048eda be181434
......@@ -40,8 +40,10 @@ python installation):
Installation
============
1. setup.py only supports RedHat systems 6 and 7. If you have other OS,
see 'python jura_to_es.py --help' and launch the tool manually.
1. setup.py only supports RedHat-like systems 6 and 7, and Ubuntu 16.04.
If you have other OS, see 'python jura_to_es.py --help' and launch
the tool manually. You might also have to launch the tool manually
if you have old Python 2.6.
1a. Remember to rerun setup.py if any parameter (ES host, index, etc.)
changes itself in the future.
2. On Redhat 6.x:
......@@ -52,7 +54,7 @@ Installation
--esindex <indexname>'
2c. Start the tool with '/etc/init.d/jura_to_es start'
2d. If needed, make 'jura_to_es' service startable at the boot with chkconfig.
3. On Redhat 7.x:
3. On Redhat 7.x or Ubuntu 16.04:
3a. In the source code directory, run
'python setup.py install --juradir <path_to_your_jura_archiving_dir>'.
3b. If you need to use other ES host/port and index, than the hardcoded
......
......@@ -211,14 +211,15 @@ def monitor_dir(xml_dir, es, es_index, record_prefix, pidfile, logfile):
import platform
on_redhat_7 = False
systemd_OS = False
OS_name = platform.platform().split("with-", 1)[1]
if (OS_name.startswith("centos") or OS_name.startswith("redhat")):
if (OS_name.startswith("centos") or OS_name.startswith("redhat")
or OS_name.startswith("Ubuntu")):
OS_version = OS_name.split("-")[1]
if OS_version.startswith("7"):
on_redhat_7 = True
if OS_version.startswith("7") or OS_version.startswith("16.04"):
systemd_OS = True
if not on_redhat_7:
if not systemd_OS:
# create daemon
daemonize(pidfile)
......
......@@ -22,22 +22,23 @@ if '--esindex' in sys.argv:
OS_name = platform.platform().split("with-", 1)[1]
if not(OS_name.startswith("centos") or OS_name.startswith("redhat")):
if not(OS_name.startswith("centos") or OS_name.startswith("redhat")
or OS_name.startswith("Ubuntu")):
print "Unsupported OS. Please, read the help of the python script itself"
print "and launch the command directly. Exiting."
sys.exit(1)
OS_version = OS_name.split("-")[1]
if OS_version.startswith("6"):
install_version = "6"
elif OS_version.startswith("7"):
install_version = "7"
systemd_OS = False
elif OS_version.startswith("7") or OS_version.startswith("16.04"):
systemd_OS = True
else:
print "Unsupported OS version. Please, read the help of the python script itself"
print "and launch the command directly. Exiting."
sys.exit(1)
if install_version == "6":
if not systemd_OS:
tool_command_line = "CMD=\"$CMD -c 'import jura_to_es; jura_to_es.main([\\\"-m\\\", \\\"-d\\\", \\\"$JURA_ARCHIVING_DIR\\\""
if es_host:
......@@ -55,7 +56,7 @@ if install_version == "6":
init_file_name = 'jura_to_es'
init_location = '/etc/init.d/'
elif install_version == "7":
else:
if '--juradir' in sys.argv:
juradir = sys.argv.index('--juradir')
sys.argv.pop(juradir) # Removes the '--juradir'
......@@ -97,9 +98,9 @@ f.close()
data_files = [('/etc/logrotate.d/', ['jura-to-es']), (init_location, [init_file_name])]
if install_version == "6":
if not systemd_OS:
os.chmod(init_file_name, 0755)
elif install_version == "7":
else:
os.chmod(init_file_name, 0644)
setup(name='jura_to_es',
......@@ -113,6 +114,6 @@ setup(name='jura_to_es',
data_files = data_files
)
if install_version == "7":
if systemd_OS:
from subprocess import call
call(["systemctl", "daemon-reload"])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment