LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2002, 04:04 AM   #1
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
shell script using /etc/cron.hourly to execute cron.php file?


I have a website I am hosting on my local server. It has some statistics functions that need to be updated. I want to use the /etc/cron.hourly file for this purpose.

The website file that does this is called /opt/ezpublish/sites/default/cron.php.

The redhat FAQ says, "All the sysadmin needs to do is drop a shell script or a link to an executable in one of the directories [referring to /etc/cron.hourly] and it will automatically be run at the appropriate time." Can anyone point me to a resource that would help me write this file?
 
Old 10-25-2002, 04:18 AM   #2
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
In this case you need PHP installed as binary (CGI) and add something like
Code:
#!/usr/bin/php -q
To your php script.

So to compile PHP for that purpose for instance do
Code:
#!/bin/bash

cp php*.tar.bz2 /usr/src
cd /usr/src
bzip2 -dc php*.tar.bz2 | tar xvf -
cd php*
./configure \
	--prefix=/tmp/php \
	--enable-ftp \
	--enable-static \
	--enable-tokenizer \
	--disable-xml \
	--without-pear \
	--with-mysql=/usr \
	--with-config-file-path=/etc \
make
make install
cp php.ini-dist /etc/php.ini
strip /tmp/php/bin/php
mv /tmp/php/bin/php /usr/bin
rm -r /tmp/php /usr/src/php*
You might need to change the variable max_execution_time in /etc/php.ini afterwards (if it's > 30 secs).

Example script:
Code:
#!/usr/bin/php -q
<?php
print "hello world\n";
?>
Remember the php script needs execution rights ... so chmod +x <filename>
 
Old 06-11-2008, 04:57 AM   #3
fatonsopa
LQ Newbie
 
Registered: Jun 2008
Posts: 1

Rep: Reputation: 0
hy, can you tell me please where to put those codes ?

Code:
#!/bin/bash

cp php*.tar.bz2 /usr/src
cd /usr/src
bzip2 -dc php*.tar.bz2 | tar xvf -
cd php*
./configure \
	--prefix=/tmp/php \
	--enable-ftp \
	--enable-static \
	--enable-tokenizer \
	--disable-xml \
	--without-pear \
	--with-mysql=/usr \
	--with-config-file-path=/etc \
make
make install
cp php.ini-dist /etc/php.ini
strip /tmp/php/bin/php
mv /tmp/php/bin/php /usr/bin
rm -r /tmp/php /usr/src/php*
 
Old 06-11-2008, 08:09 AM   #4
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
The plural of "code" is "code".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
run shell script on cron varunbihani Linux - Newbie 5 07-08-2005 01:50 AM
shutup cron.hourly mail reports darkleaf Linux - Software 4 06-27-2005 10:28 AM
cron NOT running php script ??!! hendrixx Programming 1 01-19-2005 05:36 AM
cron.hourly question Raw Kuts Linux - Newbie 1 08-18-2003 12:34 PM
How do I run/write an hourly cron? KoopaTroopa Linux - Newbie 1 08-16-2003 06:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration