Python Forum
How to trigger python script twice a day
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to trigger python script twice a day
I want to trigger my python program every day at 8 am & 11 pm. I try to test this using below code, but the program did work well.

import schedule
import time

def job():
    print("I'm working...")
print('hi at 23:06')
print('Hi 23:08')
How to trigger at specified times?
I didn't use schedule module before, but it seems from docs that you need to run it in an infinite loop, i.e. your code should be something like this:

import schedule
import time
def job():
    print("I'm working...")
    print("hi at %s" % time.ctime())


while True:

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas, How to trigger parallel loop Mekala 4 1,083 Oct-29-2020, 12:58 PM
Last Post: Mekala
  How to kill a bash script running as root from a python script? jc_lafleur 4 2,085 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 1,044 May-28-2020, 05:27 PM
Last Post: micseydel
  Package python script which has different libraries as a single executable or script tej7gandhi 1 1,456 May-11-2019, 08:12 PM
Last Post: keames
  How to run python script which has dependent python script in another folder? PrateekG 1 1,788 May-23-2018, 04:50 PM
Last Post: snippsat
  How to call one python script and use its output in another python script lravikumarvsp 3 27,852 May-16-2018, 02:08 AM
Last Post: lravikumarvsp
  Why does my Switch trigger all Cases? IAMK 6 2,075 Apr-09-2018, 11:12 AM
Last Post: snippsat
  Check Python version from inside script? Run Pythons script in v2 compatibility mode? pstein 2 8,304 Jul-07-2017, 08:59 AM
Last Post: snippsat
  How to trigger a function by clicking the left mouse click? HelloBoyz 1 6,018 Jun-29-2017, 09:43 PM
Last Post: nilamo
  Cant pass corect variables to python script in bash script neradp 3 4,328 Nov-05-2016, 01:26 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020