Welcome to WebmasterWorld Guest from 54.167.213.22

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Need some advice. How to - .pl script

     
2:41 pm on Jul 26, 2008 (gmt 0)

5+ Year Member



I am trying to setup a program in Flash using PHP and MySQL. When I came to a portion of it that needs to be automatically updated with or without the end user being logged on I was told I needed to use a cronjob.

Now to be honest I have never touched this is my life. I found the information about setting up a cronjob and now I need to setup a .pl script. Basically the this script would need to update the credits field in a table every 15 minutes based on the end users account field.

If someone could point me in the right direction as to where I might find something like this or how to write it, that would be much appreciated! Thanks!

MM

3:03 pm on Jul 26, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



sure. cronjobs are set up with
crontab -e -u username
where username is the user the cron should be executed under.
format is:
m h dom mon dow command
so, let's say you want to run your script every 30 minutes, just put in a line
0,30 * * * * /var/www/myscripts/update-credits.pl

as for the perl-script itself, you basically copy it to the server into the cgi-bin, make sure you used unix-linebreaks and chmod it to 755.
but you don't necessarily need a perl-script for a cronjob, you can also use a php-script and call it using lynx or wget. that'll invoke the script and you can do your updates.

5:08 pm on Jul 26, 2008 (gmt 0)

5+ Year Member



Where to find information about cronjobs? Do you really need to ask? google. ;)

Many hosts have a control that makes setting up cronjobs very simple.

5:12 pm on Jul 26, 2008 (gmt 0)

5+ Year Member




unix-linebreaks and chmod it to 755.

755 is for a CGI script. For a script run by a cronjob 700 (or lower) is advisable. It should also not be put in the public cgi-bin if possible. It should be in a folder that is not web accessible, above the root if at all possible. If that is not possible the cgi-bin should be the last resort but don't chmod to 755 unless the script will not run with lower permissions.

5:26 pm on Jul 26, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



ah, you're right, I was a little off and kept writing how to put a perl script on a website :)
6:55 pm on Jul 26, 2008 (gmt 0)

5+ Year Member



Thnks so much for the info! I have looked this up Janharders and now know which way to proceed (I hope) LOL

perl_diver, LOL wasnt asking about cronjobs. Re-read my post (second paragraph) ;)

7:27 pm on Jul 26, 2008 (gmt 0)

5+ Year Member



perl_diver, LOL wasnt asking about cronjobs. Re-read my post (second paragraph) ;)

oops.... my bad. Thanks for having a sense of humor. :)

7:42 pm on Jul 26, 2008 (gmt 0)

5+ Year Member



LOL no worries :) Life would be too boring without one ;)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month