I have scheduled a python file to run in Linux through cron job so only broadcast message is coming but user input is not coming up

Solution for I have scheduled a python file to run in Linux through cron job so only broadcast message is coming but user input is not coming up
is Given Below:

import sys
import platform
import os
if platform.system() == "Linux":
   cmd= ' sudo wall "System going to shutdown at 5:00 AM UST"'
   os.system(cmd)
print("Type yes/no to snooze the  shutdwon ")
snooze=input('snooze:')
def shutdown():
      if snooze == "yes" :
         delay_time=input("enter delay_time to shutdown:")


         if platform.system()== 'Linux':
            print(" Hello this is Linux os")
            command= 'sudo wall  "System going to shutdown at {} "'.format(delay_time)
            os.system(command)
         
      if platform.system() == "Linux" and snooze == "no": 
         cmd= 'sudo wall "System going to shutdown at 5:00 AM UST"'
         os.system(cmd)
 shutdown()

After running through cron job I’m getting just broadcast message so I need to get user input yes or no to snooze .Please help me.

cron has no access to the invoking user’s terminal, or to your desktop GUI. You will need to refactor your code to get the answer by other means.

But the proper solution here is probably to hook something into your GUI to run periodically when you are logged in to your desktop. How exactly to do that depends on your platform. Run my Python script at login on linux has some hints but Linux desktop environments are a moving target, and you haven’t told us which distro and GUI framework you’re on.

Alright, I guess you need the function like this

change your python script replacesnooze=input('snooze:') to snooze=sys.argv[1] and save the file to test.py
import sys
import platform
import os
if platform.system() == "Linux":
   cmd= ' sudo wall "System going to shutdown at 5:00 AM UST"'
   os.system(cmd)
print("Type yes/no to snooze the  shutdwon ")
#snooze=input('snooze:')
snooze=sys.argv[1]
def shutdown():
      if snooze == "yes" :
         # delay_time=input("enter delay_time to shutdown:")
         delay_time=sys.argv[2]



         if platform.system()== 'Linux':
            print(" Hello this is Linux os")
            command= 'sudo wall  "System going to shutdown at {} "'.format(delay_time)
            os.system(command)
         
      if platform.system() == "Linux" and snooze == "no": 
         cmd= 'sudo wall "System going to shutdown at 5:00 AM UST"'
         os.system(cmd)

shutdown()
edit your crontab command
* * * * * python test.py yes 1

or just running

python test.py yes/no 1