cron job - shell code correction


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cron job - shell code correction
# 1  
Old 03-21-2009
cron job - shell code correction

Hi I have a website that is having problem with cron jobs...

I have a cron job set up to go to a page with this code...

<?
include('config.php');
if($_sys->bible_email_frequency == 'DAILY')
{
$u = new user();
$u->send_bible_email();
}
?>

If i send my browser to this page then the action occurs okay but if I set a cron job to go there I get no action at all. Some one said that this code is not shell compliant and it needs to be.

Can anyone correct it for me?

Thanks
# 2  
Old 03-21-2009
A user cannot use the crontab command if one of the following is true:
* The cron.allow file and the cron.deny file do not exist (allows root user only).
* The cron.allow file exists but the user's login name is not listed in it.
* The cron.deny file exists and the user's login name is listed in it.

check man crontab.
# 3  
Old 03-21-2009
Quote:
Originally Posted by whybelieve
I have a cron job set up to go to a page with this code...
I've never heard of using cron to visit web pages. Maybe it will work, but I would do whatever you are doing with a Bash shell script.

But since you already have it all setup as a PHP script, you could probably do it something like this. Here I'm assuming you want it to run at 1:15 AM every day. If you don't have access to the actual crontab, then just ignore the leading numbers and asterisks.
Code:
15 1 * * *  /usr/bin/php  /some/path/file.php

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script not getting called through cron job but executes fine manually.

Hi, My shell script not getting called through cron job. The same works fine when executed manually. I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins: */5 * * * * /home/myfolder/abc.sh... (17 Replies)
Discussion started by: Dejavu20
17 Replies

2. UNIX for Dummies Questions & Answers

cron job for the created shell script

Hi am newbie for unix shell.. how to create a cron job for my already created shell script.:confused: Thanks! (1 Reply)
Discussion started by: vidhyaS
1 Replies

3. Solaris

Shell Script gives error when run through cron job.

Hi, The following shell script runs without any problem when executed manulally. USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1) if then find /arch/AUBUAT/ -type f -mtime +0 | xargs rm find /arch/AUBMIG/ -type f -mtime +0 | xargs rm fi But the same gives below... (6 Replies)
Discussion started by: ksadiq79
6 Replies

4. Shell Programming and Scripting

Cron job shell script..

Hey Guys, i was trying out a shell script which has to remove a file for every 90 mins. this is the code i came up with . $ crontab -e file1 file1 contains 30 1 * * * * rm -r /folder1/folder2/somefile.txt Now i need the cron to run for every 90 mins. the problem with this is... (8 Replies)
Discussion started by: Irishboy24
8 Replies

5. Shell Programming and Scripting

URGENT: cron job not running the sqlplus command in shell script

cron job not running the sqlplus command in shell script but the shell script works fine from command line.. Cronjob: 5 * * * * /home/dreg/script.sh script.sh: #!/bin/ksh /oracle/u000/app/oracle/product/10204/GEN/bin/sqlplus -s <user>/<pass>@<sid/home/dreg/sqlscript.sh ... (18 Replies)
Discussion started by: Ikea
18 Replies

6. Programming

Re : Pass parameters from Cron job to Java code

Hello All, Hope all is fine. I am newbie to Unix. I am using Bourne Shell (sh). One of the question I have is that I am trying to read XML file and based on reading that XML file I want to run same java programs at different hours. When I run the Java code, I wanted to pass parameters to my... (1 Reply)
Discussion started by: samshaw
1 Replies

7. UNIX for Dummies Questions & Answers

shell script run by user or cron job ?

My shell script runs fine both as a cron job and when i issue it. However, I wish to differentiate when it runs as a cron-job so the "echo" statements are not issued (they get mailed to me, which i don't want). I tried checking $USER but since the cron was created in my user that does not... (5 Replies)
Discussion started by: sentinel
5 Replies

8. Shell Programming and Scripting

Terminal And Cron Job Return Different Status Code

Dear All, I want to write a shell script to test the server is running or not. The method is pinging the server and examine the status code. the script: #/bin/tcsh ping -c 3 host if ($? != 0) then actionA endif This script work fine in terminal. The status code is 0 when the... (1 Reply)
Discussion started by: isaac_ho
1 Replies

9. Shell Programming and Scripting

Backup with shell program and cron job.

Hi, The object of my program is to take automatic backup on daily basis to different folders. I have created the respective folders. when I execute below given shell program manually it is working perfectly and taking the backup to respective folder. #!/bin/sh #script to take backup on... (1 Reply)
Discussion started by: jarkvarma
1 Replies

10. Shell Programming and Scripting

CRON-Job / Shell-Skript deleting special files

Just I'm trying to find script, which will do the following job: 1. as a CRON-Job it shoult a) delete files which will be either older than 24 hours or b) all files within a) a directory deleting recursive b) only a special directory. 2. write an error-/Delete_log... (9 Replies)
Discussion started by: ManfredWL
9 Replies
Login or Register to Ask a Question