FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Cron Jobs





pluto
I'm experiencing something weird with running a program under cron jobs. when I set the program to run every 1/2 hour, the program does not run. However, when I set the program to run every 5 minutes, the program runs fine. Any idea as to why this is happening?

Thanks,
Peterssidan
How can I find where to set up a cron job. in the help i found this but in DirectAdmin there is no link "cron jobs". Do it have to be switch on?
pluto
Quote:
How can I find where to set up a cron job. in the help i found this but in DirectAdmin there is no link "cron jobs". Do it have to be switch on?


Cron jobs was automatically turned on for me. Under the "your account" menu, click on the "Site Summary / Statistics / Logs" link. If you scroll down you will see cron jobs listed on the left and the status listed on the right.

To set up a job, go to the "advanced features" menu and click on cron jobs. Enter the appropriate information in the 'Create a New Cron Job' section. The command filed is the path name to your program or script.

I hope this helps.
Peterssidan
the cron jobs is turned OFF for me. Is there a way to turn it on? Think
mOrpheuS
Peterssidan wrote:
the cron jobs is turned OFF for me. Is there a way to turn it on? Think

Just create a new thread in the "Request an Account Change" section and it will be taken care of.
pluto
I have yet to find an answer to my earlier post: why cron jobs runs when I set it to run every 5 minutes, but does not run when I set it to run every 30 minutes.

Can anyone provide any insight as to why this is happening?

Thanks.
tidruG
pluto wrote:
I have yet to find an answer to my earlier post: why cron jobs runs when I set it to run every 5 minutes, but does not run when I set it to run every 30 minutes.

Can anyone provide any insight as to why this is happening?

Thanks.

I spoke to Bondings about this.
He thinks there's probably a problem with your script. Maybe you'd like to share that for some scrutiny?
pluto
Quote:
I spoke to Bondings about this.
He thinks there's probably a problem with your script. Maybe you'd like to share that for some scrutiny?


Here is my program (coded in Python) that I set cron jobs to run, I hope this is the 'script' you were refering to.

Thanks for the help! Smile

Code:

#!/usr/bin/python
from __future__ import generators
import time

def capital(f):
    '''capitalizes first letter in each name, stores in list, returns list'''
    cap = []
    for name in f:
        cap.append(name.capitalize())
    return cap

def remove(x):
    '''removes end of line character from list, returns new list'''
    rem = []
    for item in x:
        rem.append(item.rstrip('\n'))
    return rem

def count(c):
    '''counts number of times item in list,turns list into dictionary, returns dictionary'''
    z ={}
    for i in c:
        number = c.count(i)
        z[i] = number
    return z

def empty(dictionary,character):
    '''removes character from dictionary, returns dictionary'''
    if dictionary.has_key(character):
        del dictionary[character]
        return dictionary
    else:
        return dictionary

def pairs(x):
    '''Converts dictionary into list and sorts list by number'''
    items = x.items()
    items.sort(lambda x,y: cmp(x[1],y[1]))
    #items.sort(key=lambda item:item[1])
    items.reverse()
    return items


def listprint(x):
    '''runs while loop,putting data into html table'''
    y = len(x)
    place = 0

    while y > 0:
      yield '''
      <tr>
      <td>%s %s</td>
      </tr>
      '''%(x[place])
      place = place + 1
      y = y - 1
     




       



#variables
#line below opens file on server
f=open('/path_to_file/file_name.txt','r')

char = ''
capitalize = capital(f)
new_names = remove(capitalize)
updated_list = count(new_names)
ready = empty(updated_list, char)
paired = pairs(ready)
tohtml = listprint(paired)
submit_time = (time.strftime('%m/%d/%Y @ %H:%M') + "\n")
start_table = '''<html>
            <head><title>Suggested Names</title></head>
    <body>
    <p><a href="/website.html">Return to web site</a></p>
    <p><a href="/file.html">See alphabetized names</a></p>
    <a name="top"></a>
    <br>
    <br>
    <table border="2" cellspacing="0" cellpadding="5">
    <tr><th>Ranked Names</th></tr>
    '''
end_table =  '''</table> 
        <p><a href="#top">Return to top</a></p>
        <p>Last updated at</p>
        </body>
        </html>'''

#write to the file on Server
f=open('path_to_file/file_name','w+')

print >>f, start_table
for html_chunk in tohtml:
    print >> f, html_chunk
print >> f,end_table, submit_time
f.close()
pluto
Has anyone had an opportunity to review my code and see where an error in the code maybe affecting cron jobs?

Thanks.
Related topics
Cron Jobs
propos des cron jobs
[RESOLVED] cron jobs
Cron jobs
I don't have cron jobs enabled ?
cron jobs
Cron Jobs
Cron Jobs
Cron Jobs
Cron jobs - running a php file
Executing automated tasks without using cron jobs
cron jobs?
Problems With Cron Jobs
Enabling Cron Jobs
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.