Skip to content
Snippets Groups Projects
0_setup.py 606 B
Newer Older
Stéphane Diemer's avatar
Stéphane Diemer committed
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import utils


def setup(interactive=True):
    dir_path = utils.get_dir(__file__)
    # This script should be installed only if the home partition is a mount point
    cmds = [
        dict(line='write', template='%s/check_services.py' % dir_path, target='/usr/local/bin/check_services.py'),
        'chmod 755 /usr/local/bin/check_services.py',
        'cat /etc/rc.local | grep "/usr/local/bin/check_services.py" || sed -i "s/^exit 0/\(sleep 200 \&\& \/usr\/local\/bin\/check_services\.py \&\)\\n\\nexit 0/g" /etc/rc.local',
    ]
    utils.run_commands(cmds)