From 0b57bcab9b96392dc86c8b8bec2b232c2fb273c8 Mon Sep 17 00:00:00 2001 From: absurdo Date: Mon, 31 Jul 2023 00:50:21 +0200 Subject: [PATCH] Fix in install ssh user --- scripts/system/install_pzoo_stats.py | 54 ++-------------------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/scripts/system/install_pzoo_stats.py b/scripts/system/install_pzoo_stats.py index 043ad0b..4ed86c7 100644 --- a/scripts/system/install_pzoo_stats.py +++ b/scripts/system/install_pzoo_stats.py @@ -112,33 +112,6 @@ if check_url.match(args.url_stats): # Create scripts pzoo """ - ps=Path('/home/'+args.user+'/pzoo/scripts') - - ps.mkdir(mode=0o755, parents=True, exist_ok=True) - - shutil.chown('/home/'+args.user+'/pzoo', args.user, args.user) - - shutil.chown('/home/'+args.user+'/pzoo/scripts', args.user, args.user) - - - if call("su - "+args.user+" -s /bin/bash -c \"composer --working-dir=/home/"+args.user+"/pzoo/scripts require guzzlehttp/guzzle:~6.0\"", shell=True)>0: - print('Error, cannot install scripts for use in check scripts') - exit(1) - else: - print('Composer dependencies for check scripts added successfully') - - # Edit get_updates.py - - with open('scripts/system/get_updates.py') as f: - get_updates=f.read() - - with open('/etc/cron.daily/get_updates.py', 'w') as f: - url_updates=args.url.replace('/getinfo/', '/getupdates/') - get_updates=get_updates.replace("http://url/to/server/token/ip", url_updates) - f.write(get_updates) - - os.chmod('/etc/cron.daily/get_updates.py', 0o700) - """ if call("sudo /opt/pythonenv/bin/pip3 install --upgrade git+https://bitbucket.org/paramecio/pastafaristats", shell=True)>0: print('Error, cannot install pastafari stats') exit(1) @@ -158,29 +131,7 @@ if check_url.match(args.url_stats): with open('/etc/systemd/system/pastafaristats.service', 'w') as f: - - systemd_unit=""" - # Save it in /etc/systemd/system/pastafaristats.service - - [Unit] - Description=Pastafari Stats - After=syslog.target - After=network.target - - [Service] - Type=simple - User=pzoo - Group=pzoo - ExecStart=pastafaristats - Restart=always - Environment=PYTHONUNBUFFERED=1 - - [Install] - WantedBy=multi-user.target - """ - - systemd_unit=systemd_unit.replace('pzoo', args.user) - + #f.write(systemd_unit) f.write('# Save it in /etc/systemd/system/pastafaristats.service\n') f.write('[Unit]\n') @@ -207,7 +158,8 @@ if check_url.match(args.url_stats): print('Pastafari stats ready') print('{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Tools installed..."}') - + """ + sleep(1) linux_distro=distro.id()