Conversion_Kitchen_Code/kitchen_counter/Blockchain2/signals.py

33 lines
1.1 KiB
Python
Executable File

# import os
# from auto_email.views import sendmail
import subprocess
import threading
import os
def run_daemon_cmd_after_15_mins():
#
# ipfs_run("/home/user/mnf/project/MNF/Blockchain2/ipfs_run_cmd.sh").start()
try:
# Use subprocess to run the shell script
result = subprocess.run(['sh', "/ipfs_run_cmd.sh"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
print("Shell script executed successfully.")
print("Output:")
print(result.stdout)
else:
print("Shell script failed with the following error:")
print("Exit Code:", result.returncode)
print("Error Output:")
print(result.stderr)
except Exception as e:
print("An error occurred:", str(e))
def new_daemon():
os.system("python manage.py crontab show")
print("######################### Cron job")
# os.system("ipfs shutdown")
# os.popen("/home/user/mnf/project/MNF/Blockchain2/ipfs_run_cmd.sh")
# sendmail(to_email=["himanshubansal9818812568@gmail.com"],email_code="IM102")