def commit(self, etag): self.clean_deletes() self.precreate_dirs() batch_file = base_path("update.sh") with open(batch_file, 'w') as fh: fh.write("sleep 5\n") for fn, new_file in self.updates: fh.write('mv %s %s\n' % (escapeshellarg(base_path(new_file)), escapeshellarg(base_path(fn)))) for fn in self.deletes: fn = base_path(fn) if os.path.isdir(fn): fh.write('rmdir %s\n' % escapeshellarg(fn)) else: fh.write('rm %s\n' % escapeshellarg(fn)) fh.write('echo -n %s > %s\n' % (etag, escapeshellarg(base_path('etag.dat')))) fh.write('rm -r %s\n' % escapeshellarg(base_path('update'))) fh.write('rm %s\n' % escapeshellarg(batch_file)) fh.write(escapeshellarg(base_path('uiltje.exe')))
def commit(self, etag): self.clean_deletes() self.precreate_dirs() batch_file = base_path("update.bat") with open(batch_file, 'w') as fh: fh.write("ping -n 5 127.0.0.1 >nul\r\n") for fn, new_file in self.updates: fh.write('move %s %s\r\n' % (escapeshellarg(base_path(new_file)), escapeshellarg(base_path(fn)))) for fn in self.deletes: fh.write('del %s\r\n' % escapeshellarg(base_path(fn))) fh.write('echo -n %s > %s\n' % (etag, escapeshellarg(base_path('etag.dat')))) fh.write('del %s\r\n' % escapeshellarg(batch_file)) fh.write('rmdir /s /q %s\r\n' % escapeshellarg(batch_file)) fh.write(escapeshellarg(base_path('uiltje.exe'))) subprocess.call([batch_file]) sys.exit(0)
def run(self): for path in execute_command('/usr/bin/php7.2 ' + self.script_path + ' ' + escapeshellarg( json.dumps(self.profile_data)) + ' 2>&1 | tee -a ' + self.log_path + self.profile_data[ 'instagramData']['instagramUsername'] + '.log'): print(path.decode('utf-8'))