Thax Alex
my problem ) I am trying to send emails on a specific time that will be define by the user so for wrote the scheduler program like
def send_sms(time,Phonen,text):
print "sending sms on "
data = {'Username':SMS_GATEWAY_USER, 'Pwd': SMS_GATEWAY_PASSWD,'PhoneNumber':Phonen,"PhoneMessage":text}
url = SMS_API_BASE_URL + urllib.urlencode(data)
handle = urllib.urlopen(url)
handle.close()
sys.stdout.write('Alarm! This alarm was scheduled at %s.\n' % time)
if __name__ == '__main__':
getm = sys.argv[1]
gettext = sys.argv[2]
config = {'apscheduler.jobstores.file.class': 'apscheduler.jobstores.shelve_store:ShelveJobStore',
'apscheduler.jobstores.file.path': '/tmp/dbfile'}
scheduler = Scheduler()
scheduler.add_jobstore(ShelveJobStore('getgo.db'), 'shelve')
alarm_time = datetime.now() + timedelta(seconds=3)
print alarm_time
scheduler.add_date_job(send_sms, alarm_time, name='alarm',
jobstore='shelve', args=[datetime.now(),getm,gettext])
scheduler.add_date_job(send_sms, alarm_time, name='alarm',
jobstore='shelve', args=[datetime.now(),getm,gettext])
print scheduler.print_jobs()
sys.stdout.write('To clear the alarms, delete the example.db file.\n')
sys.stdout.write('Press Ctrl+C to exit\n')
scheduler.start()
try:
# This is here to prevent the main thread from exiting so that the
# scheduler has time to work -- this is rarely necessary in real world
# applications
time.sleep(9999)
finally:
# Shut down the scheduler so that the job store gets closed properly
scheduler.shutdown()
ok this is what i have written now suppose if i want to send another message at different time then i will call this scheduler like sc.py ans params
so i run the main python file again i just want to know that if i will run it again then my previoud job will be execute or not at the TIME THAT I DEFINE FOR THAT ?