Re: [PHP] crontab, PHP and MACOSX
On 3/28/07, Chris [EMAIL PROTECTED] wrote: There is a lot of require_once(' ') in the script and if i am not in the correct folder the script won't work. That is something php related ;) Change your require to something like this: require(dirname(__FILE__) . '/other_file_name.php'); -- Postgresql php tutorials http://www.designmagick.com/ Thanks for the hint. I found s solution to execute the php script from the cron scheduler: add a at the end of the crontab command Thank for your help. yvan
[PHP] crontab, PHP and MACOSX
Hello all, I don't know if it's the correct list, but as a php script is involved I try to start a set up a crontab job with crontab -e, which should start a php script: */10* * * * cd /Users/yvan/Sites/est-pac/ ; /usr/bin/php /Users/yvan/Sites/est-pac/controller.php but nothing happens, and in the /etc/crontab or in /private/etc/crontab the job is not listed. As I am using Mac OS 10.4.9, should I use launchd? or does someone use crontab with a mac? I try a GUI application called CronniX to setup the job but without success. Any hints? Thanks in advance for your time and help. cheers yvan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab, PHP and MACOSX
Yvan wrote: Hello all, I don't know if it's the correct list, but as a php script is involved I try to start a set up a crontab job with crontab -e, which should start a php script: */10* * * * cd /Users/yvan/Sites/est-pac/ ; /usr/bin/php /Users/yvan/Sites/est-pac/controller.php but nothing happens, and in the /etc/crontab or in /private/etc/crontab the job is not listed. As I am using Mac OS 10.4.9, should I use launchd? or does someone use crontab with a mac? I try a GUI application called CronniX to setup the job but without success. Any hints? Thanks in advance for your time and help. cheers yvan It wouldn't appear in /etc/crontab, which is a system level file. My Mac is being repaired but aren't /etc and private/etc the same directory? Check your mail by typing mail and reading your mail. If there's an error it should/may be reported there (again I'm not sure about OS X). Otherwise, or in addition, check your system error logs. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab, PHP and MACOSX
Yvan wrote: Hello all, I don't know if it's the correct list, but as a php script is involved Nope, not the right list. Cron isn't running - which has absolutely nothing to do with php. I try to start a set up a crontab job with crontab -e, which should start a php script: */10* * * * cd /Users/yvan/Sites/est-pac/ ; /usr/bin/php /Users/yvan/Sites/est-pac/controller.php You don't need the cd command, change it to: /usr/bin/php /Users/yvan/Sites/est-pac/controller.php also add a MAILTO=your_email_Address.com at the top of the file in case it's throwing any errors. No idea where mac puts cron files but on linux systems it's usually /var/spool/cron/your_user_name (I'm guessing *bsd is the same but ask them). If you're still having problems I'd suggest asking a mac list. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab, PHP and MACOSX
On March 28, 2007, [EMAIL PROTECTED] wrote: this question really has nothing to do with php ... that said. on standard unix systems, user-level crontabs (which is what you're writing with the crontab -e command) are found in /var/spool/cron/user. there's also generally a cron log in /var/log/. you should check the cron log file to confirm that the cron is running. if there isn't a cron log file you might want to look in /etc/syslog.conf to see where it says cron messages are being put. if a cron runs a job but the job fails for some reason, mail is sent to the user under which the cron is being run. anything output to stdout is also sent to that user. i.e., check the mail of the user under which you're running this cron. [this assumes that your system is configured to handle local mail.] [the above are for standard unix systems, i've never actually touched macOSX.] - Rick Shell command as cron jobs work and errors are also send to the local mail, but php scripts are not executed, is their any permission issues ? the same con job work fine on a centos box. Thank anyway for the hints yvan Original Message Date: Wednesday, March 28, 2007 03:55:09 PM -0700 From: Yvan [EMAIL PROTECTED] To: php-general@lists.php.net Cc: Subject: [PHP] crontab, PHP and MACOSX Hello all, I don't know if it's the correct list, but as a php script is involved I try to start a set up a crontab job with crontab -e, which should start a php script: */10* * * * cd /Users/yvan/Sites/est-pac/ ; /usr/bin/php /Users/yvan/Sites/est-pac/controller.php but nothing happens, and in the /etc/crontab or in /private/etc/crontab the job is not listed. As I am using Mac OS 10.4.9, should I use launchd? or does someone use crontab with a mac? I try a GUI application called CronniX to setup the job but without success. Any hints? Thanks in advance for your time and help. cheers yvan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- End Original Message -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab, PHP and MACOSX
On March 28, 2007, Chris wrote: Yvan wrote: Hello all, I don't know if it's the correct list, but as a php script is involved Nope, not the right list. Cron isn't running - which has absolutely nothing to do with php. I try to start a set up a crontab job with crontab -e, which should start a php script: */10* * * * cd /Users/yvan/Sites/est-pac/ ; /usr/bin/php /Users/yvan/Sites/est-pac/controller.php You don't need the cd command, change it to: /usr/bin/php /Users/yvan/Sites/est-pac/controller.php also add a MAILTO=your_email_Address.com at the top of the file in case it's throwing any errors. No idea where mac puts cron files but on linux systems it's usually /var/spool/cron/your_user_name (I'm guessing *bsd is the same but ask them). If you're still having problems I'd suggest asking a mac list. There is a lot of require_once(' ') in the script and if i am not in the correct folder the script won't work. ok i will ask a mac list, sorry for the noise thanks yvan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab, PHP and MACOSX
Shell command as cron jobs work and errors are also send to the local mail, but php scripts are not executed Does running the command manually work? If not, there's your problem. If it does, then it's a cron issue. Still something you should ask about on a mac mailing list. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab, PHP and MACOSX
There is a lot of require_once(' ') in the script and if i am not in the correct folder the script won't work. That is something php related ;) Change your require to something like this: require(dirname(__FILE__) . '/other_file_name.php'); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab for Windows
bob wrote: Hi, I am trying to schedule the running of some PHP scripts on my Win2K PC at home. On my live server I use Linux, so am fully familiar with Crontab. I am not that familiar with running scripts using the scheduler in Win2K though. So far what I have is: C:\php\php.exe -q c:\path\to\php\file.php what happens if you quote everything?: C:\php\php.exe -q c:\path\to\php\file.php But this doesn't seem to do anything..the task manager in the windows scheduler just keeps saying that the task has not been run. Any suggestions? Also, one thing I would like my script to do is to send out an email, but I don't have a mail server set up on my home PC..is there anyway to run a script from a server on a different machine, using Windows scheduler, and if so, what form would the 'path' to the file/server take? Many thanks Alexis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab for Windows
On W3K you could use this as the run line in Scheduled Tasks and probably the same in XP although I have not tested this. The same components exist in the W2K version although may be in different locations/names. Run: cmd /c c:\php\php.exe -q c:\path\to\php\file.php Start in: C:\path\to\php\file\ Run as: username/pass with security acess to both php.exe and the file.php YMMV pjn - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, February 18, 2005 10:06 PM Subject: Re: [PHP] Crontab for Windows bob wrote: Hi, I am trying to schedule the running of some PHP scripts on my Win2K PC at home. On my live server I use Linux, so am fully familiar with Crontab. I am not that familiar with running scripts using the scheduler in Win2K though. So far what I have is: C:\php\php.exe -q c:\path\to\php\file.php what happens if you quote everything?: C:\php\php.exe -q c:\path\to\php\file.php But this doesn't seem to do anything..the task manager in the windows scheduler just keeps saying that the task has not been run. Any suggestions? Also, one thing I would like my script to do is to send out an email, but I don't have a mail server set up on my home PC..is there anyway to run a script from a server on a different machine, using Windows scheduler, and if so, what form would the 'path' to the file/server take? Many thanks Alexis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab for Windows
[EMAIL PROTECTED] wrote: On W3K you could use this as the run line in Scheduled Tasks and probably the same in XP although I have not tested this. The same components exist in the W2K version although may be in different locations/names. Run: cmd /c c:\php\php.exe -q c:\path\to\php\file.php This is *very* close to what I use with Windows XP (actually I use this for file types so that I can right click and run a PHP file on the command line). cmd /K C:\php\php.exe -f %1 The %1 is a variable that gets replaced. If you set this up for the file type then the %1 is the name of the file. So to apply this knowledge to scheduled tasks, you can do: cmd /K C:\php\php.exe -f C:\path\to\your\file.php Start in: C:\path\to\php\file\ Run as: username/pass with security acess to both php.exe and the file.php Agreed... it is much easier to manage it this way although it is *possible* to use the command runas to execute PHP as a different user. For help on these commands, just use: cmd /? runas /? YMMV pjn -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Crontab for Windows
Hi, I am trying to schedule the running of some PHP scripts on my Win2K PC at home. On my live server I use Linux, so am fully familiar with Crontab. I am not that familiar with running scripts using the scheduler in Win2K though. So far what I have is: C:\php\php.exe -q c:\path\to\php\file.php But this doesn't seem to do anything..the task manager in the windows scheduler just keeps saying that the task has not been run. Any suggestions? Also, one thing I would like my script to do is to send out an email, but I don't have a mail server set up on my home PC..is there anyway to run a script from a server on a different machine, using Windows scheduler, and if so, what form would the 'path' to the file/server take? Many thanks Alexis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crontab for Windows
On my live server I use Linux, so am fully familiar with Crontab. I am not that familiar with running scripts using the scheduler in Win2K though. I use nncronlite which is a cron implementation for windoz (familiar crot.tab file); http://www.batchconverter.com/nnCronLITE-download-16062.shtml One problem I encountered with the MS scheduler, is it needed to be running as a process, and in an implementation of windows that had Microsoft SQL Server running on NT, seems this SQL server has the ability to schedule some batch processes, but it implemented a replacement for the batch scheduler that would not process my AT commands. In windoz the AT command is used to add processes to the schedule. hope this helps, Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab for Windows
bob wrote: C:\php\php.exe -q c:\path\to\php\file.php But this doesn't seem to do anything..the task manager in the windows scheduler just keeps saying that the task has not been run. Any suggestions? The Task Scheduler uses the 'at' command under the hood, same as cron... Perhaps if you dig down into your 'at' command and see if it's broken... Also, one thing I would like my script to do is to send out an email, but I don't have a mail server set up on my home PC..is there anyway to run a script from a server on a different machine, using Windows scheduler, and if so, what form would the 'path' to the file/server take? If a full-fledged SMTP server is too much hassle, and you're looking to send a relatively light load of email, I've been told that the Pegasus email client is quite happy and easily run from a command line to send out mail under Windows. YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crontab PHP Script
Just some closure on my crontab question: 1 - Since my linux box has Plesk 7 (PSA) and it already had php installed on it I guess php is installed in the /usr/local/psa/admin/bin/php directory. Pretty sure atleast since the below crontab command is now executing my script: /usr/local/psa/admin/bin/php /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php I believe traditionally php is installed in /usr/local/bin/php but I could be wrong...this is what was throwing me off. 2 - Tim, you were right, all stars will make the crontab run every minute on my linux box -Original Message- From: Tim Traver [mailto:[EMAIL PROTECTED] Sent: Sunday, June 27, 2004 1:17 AM To: Ryan Schefke; Php-General-Help; [EMAIL PROTECTED] Subject: Re: [PHP] Crontab PHP Script Not sure if this is different in linux, but usually the first parameter is the minutes, and if you had 01 in it, that means that it would do it once an hour (i.e. 12:01, 1:01, 2:01, etc... They should all have stars to do it once a minute. In freeBSD, it would look like this : * * * * root/usr/local/bin/php home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php Tim. At 04:34 PM 6/26/2004, Ryan Schefke wrote: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. I made a quick php script called crontab.php to email me. == ?php //send email on domain /* subject */ $str_subject = crontab test; /* message */ $messagecontent = this is a test to see if crontab working nightly\n\n; /* to */ $to = [EMAIL PROTECTED]; /* from */ $headers .= From: tgWedding [EMAIL PROTECTED]\r\n; /* bcc */ // $headers .= Bcc: [EMAIL PROTECTED]; mail($to, $str_subject, $messagecontent, $headers); ? Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php https://217.160.251.56:8443/sysuser/crontab_edit.php?cte_src=CTEJKgkqCSoJK g kvaG9tZS9odHRwZC92aG9zdHMvdGd3ZWRkaW5nLmNvbS9odHRwZG9jcy90Z3dlZGRpbmcvY3Jvb n RhYi5waHA= I used * for every field except M, which I set to 01 to run every minute. It's not working...can someone guide me along and let me know what I've done wrong. Thanks, Ryan SimpleNet's Back ! http://www.simplenet.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Crontab PHP Script
Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. I made a quick php script called crontab.php to email me. == ?php //send email on domain /* subject */ $str_subject = crontab test; /* message */ $messagecontent = this is a test to see if crontab working nightly\n\n; /* to */ $to = [EMAIL PROTECTED]; /* from */ $headers .= From: tgWedding [EMAIL PROTECTED]\r\n; /* bcc */ // $headers .= Bcc: [EMAIL PROTECTED]; mail($to, $str_subject, $messagecontent, $headers); ? Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php https://217.160.251.56:8443/sysuser/crontab_edit.php?cte_src=CTEJKgkqCSoJKg kvaG9tZS9odHRwZC92aG9zdHMvdGd3ZWRkaW5nLmNvbS9odHRwZG9jcy90Z3dlZGRpbmcvY3Jvbn RhYi5waHA= I used * for every field except M, which I set to 01 to run every minute. It's not working...can someone guide me along and let me know what I've done wrong. Thanks, Ryan
Re: [PHP] Crontab PHP Script
Ryan Schefke wrote --- napísal:: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php The crontab command should be: /path/to/php /path/to/your/crontab.php Add -q parameter if the php executable is cgi and not cli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab PHP Script
On Sat, 2004-06-26 at 19:34, Ryan Schefke wrote: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. You need to add #!/usr/bin/php At the start of your script so it knows how to run it. You will also need to set the permission bits to allow execution chmod 700 Change the path to where you have the cli version of php on your system. -- Scot L. Harris [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab PHP Script
Not sure if this is different in linux, but usually the first parameter is the minutes, and if you had 01 in it, that means that it would do it once an hour (i.e. 12:01, 1:01, 2:01, etc... They should all have stars to do it once a minute. In freeBSD, it would look like this : * * * * root/usr/local/bin/php home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php Tim. At 04:34 PM 6/26/2004, Ryan Schefke wrote: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. I made a quick php script called crontab.php to email me. == ?php //send email on domain /* subject */ $str_subject = crontab test; /* message */ $messagecontent = this is a test to see if crontab working nightly\n\n; /* to */ $to = [EMAIL PROTECTED]; /* from */ $headers .= From: tgWedding [EMAIL PROTECTED]\r\n; /* bcc */ // $headers .= Bcc: [EMAIL PROTECTED]; mail($to, $str_subject, $messagecontent, $headers); ? Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php https://217.160.251.56:8443/sysuser/crontab_edit.php?cte_src=CTEJKgkqCSoJKg kvaG9tZS9odHRwZC92aG9zdHMvdGd3ZWRkaW5nLmNvbS9odHRwZG9jcy90Z3dlZGRpbmcvY3Jvbn RhYi5waHA= I used * for every field except M, which I set to 01 to run every minute. It's not working...can someone guide me along and let me know what I've done wrong. Thanks, Ryan SimpleNet's Back ! http://www.simplenet.com
[PHP] crontab
Can I run a php script in crontab? Do I echo or print? Anyone doing it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
Can I run a php script in crontab? Do I echo or print? Anyone doing it? This is a serious security hazard. However, what you could do is have a PHP page set cron settings (such as name of file, location, frequency, and importance), then have another cron job (running at a decent frequency) do the organization. However, this is still a security flaw, as hackers can just take a look at your cron jobs and get in and run their own in place of yours. Probably no more a flaw than normal, though, as if a hacker can get in to replace your cron job, they can get in and run any number of things anyway. Make sure to hard code your cron jobs, as having a downloadable page is a bigger security hazard. You don't want the PHP page to do this itself, because it will have to run as root. I did this one time, and if I'm allowed some time to get my page up, I can e-mail you some instructions. What you'll need is a PHP page, a txt file (for the settings) and a cron job that will read the file and do the necessary steps to arrange the cron jobs itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] crontab
1: yes you can. 2: You can use either print or echo. I use echo when I actually want something output, most of my scripts don't output anything. If there is some output of import, I use mail() to send it to myself. 3: Yes, I am. * Cal Evans * Stay Plugged Into Your Audience * http://www.christianperformer.com -Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 2:45 PM To: [EMAIL PROTECTED] Subject: [PHP] crontab Can I run a php script in crontab? Do I echo or print? Anyone doing it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
Cal, Liam, Jimmy, Thanks. If this is a serious security hazard, could you show me some code that is more secure? I am the root. Mind you I've never worked with crontab before. I want to run /var/www/backup_mysql.php I suppose I should start by putting it somewhere not publicly accessible? Thanks, John Liam Gibbs wrote: Can I run a php script in crontab? Do I echo or print? Anyone doing it? This is a serious security hazard. However, what you could do is have a PHP page set cron settings (such as name of file, location, frequency, and importance), then have another cron job (running at a decent frequency) do the organization. However, this is still a security flaw, as hackers can just take a look at your cron jobs and get in and run their own in place of yours. Probably no more a flaw than normal, though, as if a hacker can get in to replace your cron job, they can get in and run any number of things anyway. Make sure to hard code your cron jobs, as having a downloadable page is a bigger security hazard. You don't want the PHP page to do this itself, because it will have to run as root. I did this one time, and if I'm allowed some time to get my page up, I can e-mail you some instructions. What you'll need is a PHP page, a txt file (for the settings) and a cron job that will read the file and do the necessary steps to arrange the cron jobs itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
I want to run /var/www/backup_mysql.php Are you just trying to backup your MySQL database? If so, check this out: http://members.lycos.co.uk/wipe_out/automysqlbackup Edit a view configuration variables (db to be backed up, path, etc), throw it in /etc/cron.daily, and forget about it. I does daily, weekly, and monthly backups. It overwrites the daily backups after seven days, so you don't have a growing number of backups taking up HD space. It overwrites the weekly backups after 5 weeks for the same reason. It never overwrites monthly backups. I use it on several server. It works really well. Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
i think one of us misunderstood your posting ... my suggestion was simply to put a php script in your crontab to be run whenever you set it to go .. if you are writing a php script to update crontab for you as Liam understood your message it is not a good idea ( actually it's a really bad idea :) ) but running a php script versus a bash or perl or whatever script/program is no more a concern than those ( always have security in mind ) On Tue, 2003-03-04 at 13:07, John Taylor-Johnston wrote: Cal, Liam, Jimmy, Thanks. If this is a serious security hazard, could you show me some code that is more secure? I am the root. Mind you I've never worked with crontab before. I want to run /var/www/backup_mysql.php I suppose I should start by putting it somewhere not publicly accessible? Thanks, John Liam Gibbs wrote: Can I run a php script in crontab? Do I echo or print? Anyone doing it? This is a serious security hazard. However, what you could do is have a PHP page set cron settings (such as name of file, location, frequency, and importance), then have another cron job (running at a decent frequency) do the organization. However, this is still a security flaw, as hackers can just take a look at your cron jobs and get in and run their own in place of yours. Probably no more a flaw than normal, though, as if a hacker can get in to replace your cron job, they can get in and run any number of things anyway. Make sure to hard code your cron jobs, as having a downloadable page is a bigger security hazard. You don't want the PHP page to do this itself, because it will have to run as root. I did this one time, and if I'm allowed some time to get my page up, I can e-mail you some instructions. What you'll need is a PHP page, a txt file (for the settings) and a cron job that will read the file and do the necessary steps to arrange the cron jobs itself. -- Jimmy Brake [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] crontab
I've not seen anything to indicate to me that running php scripts in a cron job (via php compiled as a CLI) is any less secure than running cron jobs written in any other language. All of mine are 700 root, the cron process runs as root and I understand that. Since I'm the root on the box, it's ok. PHP does not 'run as root'. The CLI will run as whomever is executing the script. My $.02 worth. =C= * Cal Evans * Stay Plugged Into Your Audience * http://www.christianperformer.com -Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 3:07 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] crontab Cal, Liam, Jimmy, Thanks. If this is a serious security hazard, could you show me some code that is more secure? I am the root. Mind you I've never worked with crontab before. I want to run /var/www/backup_mysql.php I suppose I should start by putting it somewhere not publicly accessible? Thanks, John Liam Gibbs wrote: Can I run a php script in crontab? Do I echo or print? Anyone doing it? This is a serious security hazard. However, what you could do is have a PHP page set cron settings (such as name of file, location, frequency, and importance), then have another cron job (running at a decent frequency) do the organization. However, this is still a security flaw, as hackers can just take a look at your cron jobs and get in and run their own in place of yours. Probably no more a flaw than normal, though, as if a hacker can get in to replace your cron job, they can get in and run any number of things anyway. Make sure to hard code your cron jobs, as having a downloadable page is a bigger security hazard. You don't want the PHP page to do this itself, because it will have to run as root. I did this one time, and if I'm allowed some time to get my page up, I can e-mail you some instructions. What you'll need is a PHP page, a txt file (for the settings) and a cron job that will read the file and do the necessary steps to arrange the cron jobs itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
Can I run a php script in crontab? Do I echo or print? Anyone doing it? Well, why don't I just completely misunderstand the question. Sorry, everyone. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
dont know..i would think you could but i have all my php tasks like crontabs running in windows and they work just fine... hehe didnt think i could do that but when i tried it it worked grin! - Original Message - From: John Taylor-Johnston [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 3:45 PM Subject: [PHP] crontab Can I run a php script in crontab? Do I echo or print? Anyone doing it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] crontab programmed with mysql ??
I'm looking for the approximate solution of mailing out (or doing anything else ) timed by cron(tab) along with use of mysql as means of identification and storing of the dates in multiuser enviroment. Initial date and interval of recurring event is to be set up by a user. May you know some open source code as an example to do that or so? Thank you, Oleg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab programmed with mysql ??
Hi, Tuesday, September 3, 2002, 7:55:56 AM, you wrote: aac I'm looking for the approximate solution of mailing out (or doing anything aac else ) aac timed by cron(tab) along with use of mysql as means of identification and aac storing aac of the dates in multiuser enviroment. aac Initial date and interval of recurring event is to be set up by a user. aac May you know some open source code as an example to do that or so? aac Thank you, aac Oleg Probably the easiest way is to set up cron to call a php script every 5 mins or whatever the smallest interval you will need and have that script run through your mysql tables looking for jobs to do. That way you only need one cron job. If you are on unix type server the simplest is to use lynx like this 5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/lynx -dump http://domain.com/chkjob.php 1 /dev/null 2 /dev/null -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Crontab
Hello, I need to run a daily script on our website but I'm trying to avoid using CRONTAB. Is there any way that I can run this daily ? Is there any equivalent to ASP's Application_OnStart for PHP ? Thanks, _ Mauricio Cuenca [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab
Program it into the homepage to run once a day. As long as you get one hit per day, then it'll run. ---John Holmes... - Original Message - From: Mauricio Cuenca [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 05, 2002 9:15 AM Subject: [PHP] Crontab Hello, I need to run a daily script on our website but I'm trying to avoid using CRONTAB. Is there any way that I can run this daily ? Is there any equivalent to ASP's Application_OnStart for PHP ? Thanks, _ Mauricio Cuenca [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crontab
[snip] Program it into the homepage to run once a day. As long as you get one hit per day, then it'll run. ... I need to run a daily script on our website but I'm trying to avoid using CRONTAB. Is there any way that I can run this daily ? [/snip] But if you need to run it only once per day you will have to have a method to do it. Using John's suggested homepage method have the daily script open a file and record the date. Then each successive hit during the day should also open that file...if today's date is already there it will not run the script again else it will run and set today's date. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CRONTAB
Hello to all !!! I write you because I have the following question: I am attempting execute automatically an script PHP, all the days at a certain hour. I configured the cron to executes it, but when it is executed, instead of working, I receive an email in my main account where say: /home/vipteam/public_html/distribuidor/mailf.php: echoNo tinterrumpir: command not found /home/vipteam/public_html/distribuidor/mailf.php: =: command not found /home/vipteam/public_html/distribuidor/mailf.php: =: command not found /home/vipteam/public_html/distribuidor/mailf.php: =: command not found /home/vipteam/public_html/distribuidor/mailf.php: line 10: syntax error near unexpected token `Rand(1 ' /home/vipteam/public_html/distribuidor/mailf.php: line 10: ` $codigo1 = rand(1,32767); ' I think that the code is not interpreted. I don't know what happen! Help, please! Regards! Julián -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRONTAB
On Fri, 5 Apr 2002, Julian wrote: I am attempting execute automatically an script PHP, all the days at a certain hour. I configured the cron to executes it, but when it is executed, instead of working, I receive an email in my main account where say: /home/vipteam/public_html/distribuidor/mailf.php: echoNo tinterrumpir: command not found If you are running from cron, you need to tell it to use the php interpreter. So either tell it in your crontab entry with something like: 0 * * * * /usr/local/bin/php /blah/blah/mailf.php Or channel it through your web server with something like this: 0 * * * * /usr/bin/lynx http://127.0.0.1/distribuidor/mailf.php Or put a comment in the first line of your PHP file that tells the shell to use PHP to run it: #!/usr/local/bin/php All of these paths are samples; you'll need to figure out where these things are on your system. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CRONTAB
Hi Miguel!! Thank you for your help! My script run fine with: 0 0 * * * /usr/bin/php /path/to/my/script.php But I continue receiving an email each time that the script run that say: X-Powered-By: PHP/4.0.6 Content-type: text/html I don't understand it, because in my script I didn't put content of this type Do you know what is the problem now?? Regards and thank for your time!! Julian - Original Message - From: Miguel Cruz To: Julian Cc: [EMAIL PROTECTED] Sent: Friday, April 05, 2002 7:26 PM Subject: Re: [PHP] CRONTAB On Fri, 5 Apr 2002, Julian wrote: I am attempting execute automatically an script PHP, all the days at a certain hour. I configured the cron to executes it, but when it is executed, instead of working, I receive an email in my main account where say: /home/vipteam/public_html/distribuidor/mailf.php: echoNo tinterrumpir: command not found If you are running from cron, you need to tell it to use the php interpreter. So either tell it in your crontab entry with something like: 0 * * * * /usr/local/bin/php /blah/blah/mailf.php Or channel it through your web server with something like this: 0 * * * * /usr/bin/lynx http://127.0.0.1/distribuidor/mailf.php Or put a comment in the first line of your PHP file that tells the shell to use PHP to run it: #!/usr/local/bin/php All of these paths are samples; you'll need to figure out where these things are on your system. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CRONTAB
On Fri, 5 Apr 2002, Julian wrote: My script run fine with: 0 0 * * * /usr/bin/php /path/to/my/script.php But I continue receiving an email each time that the script run that say: X-Powered-By: PHP/4.0.6 Content-type: text/html PHP thinks it's producing output to be sent via a web server, so it outputs those headery lines. Changing /usr/bin/php to /usr/bin/php -q will probably fix the problem. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRONTAB
On Fri, Apr 05, 2002 at 09:42:02PM -0300, Julian wrote: 0 0 * * * /usr/bin/php /path/to/my/script.php But I continue receiving an email each time that the script run that say: X-Powered-By: PHP/4.0.6 Content-type: text/html Those two lines are PHP's default output. Crontab, by default, sends output of programs to the user by email. You can change both behaviors by doing this: 0 0 * * * /usr/bin/php -q /path/to/my/script.php /dev/null 21 Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CRONTAB
YES!! MY SCRIPT RUN AND I'M NOT RECEIVING ANY EMAIL! Thanks to all!! Specials thanks to Miguel and Dan!! Regards! Julian - Original Message - From: Analysis Solutions To: PHP List Sent: Friday, April 05, 2002 9:44 PM Subject: Re: [PHP] CRONTAB On Fri, Apr 05, 2002 at 09:42:02PM -0300, Julian wrote: 0 0 * * * /usr/bin/php /path/to/my/script.php But I continue receiving an email each time that the script run that say: X-Powered-By: PHP/4.0.6 Content-type: text/html Those two lines are PHP's default output. Crontab, by default, sends output of programs to the user by email. You can change both behaviors by doing this: 0 0 * * * /usr/bin/php -q /path/to/my/script.php /dev/null 21 Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Crontab
Hello, I am facing some problem in the crontab...Can anyone tell me how to solve this Actually i have written the php script to send mail to the users after a week.In the crontab i have made a entry so that it will trigger after 12.05. 5 0 * * * lynx http://info/php/MailForm.php I have received a mail like this.And also it didn't send the mail to the userswhy it is so Your terminal lacks the ability to clear the screen or position the cursor. -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crontab
This is why I love lists. I was going to have to do something similar this week and was planning on using perl, never thought about running php from the command line. Thanks, =S. On Wed, 27 Feb 2002, Sven Jacobs wrote: I've use a script that I put in my cron.weekly to execute a php script and it works fine :-) #! /bin/sh #Run Report Generation Script /usr/bin/php4 /usr/share/netsaint/genmonrep.scp.php Kind Regards Sven -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: mercredi 27 février 2002 8:04 To: [EMAIL PROTECTED] Subject: Re: [PHP] Crontab On Wednesday 27 February 2002 13:11, Uma Shankari T. wrote: Hello, I need to run one php script using crontab.I am having this doubt.If the phpscript run in the command prompt then only we can run the script using crontab...please tell me how do i go about with this.. You can have crontab run lynx/links to access your php page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Crontab
Hello, I need to run one php script using crontab.I am having this doubt.If the phpscript run in the command prompt then only we can run the script using crontab...please tell me how do i go about with this.. -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab
Compile php as a CGI then write a script that begins as such. #!/usr/local/bin/php -q ?php / / code here ? Chmod on file and place in crontab. - Original Message - From: Uma Shankari T. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 26, 2002 11:11 PM Subject: [PHP] Crontab Hello, I need to run one php script using crontab.I am having this doubt.If the phpscript run in the command prompt then only we can run the script using crontab...please tell me how do i go about with this.. -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab
see whether the command line option is available on your server. sanjay - Original Message - From: Uma Shankari T. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 27, 2002 10:41 AM Subject: [PHP] Crontab Hello, I need to run one php script using crontab.I am having this doubt.If the phpscript run in the command prompt then only we can run the script using crontab...please tell me how do i go about with this.. -Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontab
On Wednesday 27 February 2002 13:11, Uma Shankari T. wrote: Hello, I need to run one php script using crontab.I am having this doubt.If the phpscript run in the command prompt then only we can run the script using crontab...please tell me how do i go about with this.. You can have crontab run lynx/links to access your php page. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* It's not the fall that kills you, it's the landing. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crontab
I've use a script that I put in my cron.weekly to execute a php script and it works fine :-) #! /bin/sh #Run Report Generation Script /usr/bin/php4 /usr/share/netsaint/genmonrep.scp.php Kind Regards Sven -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: mercredi 27 février 2002 8:04 To: [EMAIL PROTECTED] Subject: Re: [PHP] Crontab On Wednesday 27 February 2002 13:11, Uma Shankari T. wrote: Hello, I need to run one php script using crontab.I am having this doubt.If the phpscript run in the command prompt then only we can run the script using crontab...please tell me how do i go about with this.. You can have crontab run lynx/links to access your php page. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* It's not the fall that kills you, it's the landing. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab help
Arnold, In the minutes field on crontab, you can add as many values as you want separated by a colon. Try somthing like this... 00,05,10,15,20,25 and so until 55 * * * ^ THIS IS A MINUTES FIELD WITH MANY VALUES We use it here and it does the job fine. Try reading crontab manpages for additional info. William Arnold Gamboa wrote: hi there. is there a way to tell crontab to do: "run script every 5 mins for 1 hour".. i have this mass email script that is so huge that i need it to chunk into records and make sure that it will run every 5 mins for 1 hour. Thanks for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] crontab help
Didn't you just ask this a few days ago? In your while loop put a sleep(300) which will sleep for 300 seconds after processing X amount of emails. --Joe On Fri, Feb 22, 2002 at 02:53:10PM +0800, Arnold Gamboa wrote: hi there. is there a way to tell crontab to do: "run script every 5 mins for 1 hour".. i have this mass email script that is so huge that i need it to chunk into records and make sure that it will run every 5 mins for 1 hour. Thanks for any help. -- --- Joe Stump, PHP Hacker, [EMAIL PROTECTED] -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] crontab help
BTW when it sleeps PHP takes up no noticable resources. Also I'm running the php binary to send out these messages (that way I can use screen and make sure that my browser doesn't crash, os freeze, etc.) --Joe On Fri, Feb 22, 2002 at 03:36:33PM +0800, Arnold Gamboa wrote: thanks for the comment let's just say i have 100k emails to send... don't you think that will drain the system resources if i send it all at once even if you have usleep(300) on each while? your comment please. put a sleep(300); at the end of your while() loop - I did this on my mass mailer and it worked like a charm. --Joe On Fri, Feb 22, 2002 at 02:53:10PM +0800, Arnold Gamboa wrote: hi there. is there a way to tell crontab to do: "run script every 5 mins for 1 hour".. i have this mass email script that is so huge that i need it to chunk into records and make sure that it will run every 5 mins for 1 hour. Thanks for any help. -- -- - Joe Stump, PHP Hacker, -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V -- - -- --- Joe Stump, PHP Hacker, [EMAIL PROTECTED] -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] crontab help
1.) sleep() is in seconds - plain old seconds - so sleep(300) == 5 minutes. 2.) yes - send, sleep, send, ... --Joe On Thu, Feb 22, 2001 at 11:09:05PM +0800, Arnold Gamboa wrote: hi, thanks again. questions: 1. sleep(300) would mean pause by 300 mins, right? That's why i thought you mean usleep(300) - 300 microseconds. please comment 2. what you mean is i will send 5000 emails, then pause and send again? Thanks for your help. I send roughly 1M of these and put a sleep() (not usleep - that's microseconds) into the while loop - I've come up with a decent balance that sends out a good number (like 5000) and then sleeps just long enough to get them out of qmail's queue, then it sends another 5000 (and so on). Usually takes about 24 hours to send out 1M messages. --Joe On Fri, Feb 22, 2002 at 03:36:33PM +0800, Arnold Gamboa wrote: thanks for the comment let's just say i have 100k emails to send... don't you think that will drain the system resources if i send it all at once even if you have usleep(300) on each while? your comment please. put a sleep(300); at the end of your while() loop - I did this on my mass mailer and it worked like a charm. --Joe On Fri, Feb 22, 2002 at 02:53:10PM +0800, Arnold Gamboa wrote: hi there. is there a way to tell crontab to do: "run script every 5 mins for 1 hour".. i have this mass email script that is so huge that i need it to chunk into records and make sure that it will run every 5 mins for 1 hour. Thanks for any help. -- -- - Joe Stump, PHP Hacker, -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V -- - -- -- - Joe Stump, PHP Hacker, -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V -- - -- --- Joe Stump, PHP Hacker, [EMAIL PROTECTED] -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]