LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2010, 06:30 AM   #1
m4manoze
LQ Newbie
 
Registered: Feb 2010
Posts: 11

Rep: Reputation: 0
regarding crond


Dear Experts,

I am using "CentOS release 5.3", i have certain python script (expire.py) to run daily, i put that file (expire.py) in /etc/cron.daily/expire.py

To my knowledge it should automatically run the python script expire.py daily, but it is not runing since users are not getting expiry emails.

But if i manually run the expire.py by:
#python expire.py

it works!!!!

I want expire.py runs daily so that user gets expiring information daily. Need help, any help will be appreciated.

Regards,
Manoj
 
Old 03-08-2010, 06:38 AM   #2
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
I think cron.daily job run every day 4.2 am ensure that system is up at that time and also ensure proper permissin on python script file.

Thanks
 
Old 03-08-2010, 08:57 AM   #3
giammy
Member
 
Registered: Feb 2010
Posts: 36

Rep: Reputation: 20
Hi,

Rember that running from cron you do not have the same environment
as user: for example you do not have the PATH (and commands should use
full path)

There're various thread on this problem in this site!

bye
giammy
 
Old 03-09-2010, 01:11 AM   #4
m4manoze
LQ Newbie
 
Registered: Feb 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by giammy View Post
Hi,

Rember that running from cron you do not have the same environment
as user: for example you do not have the PATH (and commands should use
full path)

There're various thread on this problem in this site!

bye
giammy
Dear Giammy,

I have given full path inside the code. Regarding file permission i have set to #chmod 777 expire.py and to all associated file needed for expire.py to run.

Is there any script or anyother method through which we can test cron.daily runing or not?

Regards,
Manoj
 
Old 03-09-2010, 01:25 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
If cron.daily is not working you can create crontab entry to run that script everyday at specified time. In addition if it does not run just that way you can explicitly call python to execute the script.
 
Old 03-09-2010, 03:37 AM   #6
giammy
Member
 
Registered: Feb 2010
Posts: 36

Rep: Reputation: 20
Quote:
Originally Posted by m4manoze View Post
Dear Giammy,

I have given full path inside the code. Regarding file permission i have set to #chmod 777 expire.py and to all associated file needed for expire.py to run.

Is there any script or anyother method through which we can test cron.daily runing or not?

Regards,
Manoj
Hi,

you can create a script

Code:
#!/bin/bash
echo "i'm cron" > /TESTCRON
and put in cron.daily.
Then check if the file /TESTCRON has been created

bye
giammy

P.S: do you already looked at logs!
 
Old 03-09-2010, 06:34 AM   #7
m4manoze
LQ Newbie
 
Registered: Feb 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linuxlover.chaitanya View Post
If cron.daily is not working you can create crontab entry to run that script everyday at specified time. In addition if it does not run just that way you can explicitly call python to execute the script.
Yes, I have call python script from bash as:

python file name : expire.py
bash script file name: expire.sh

In expire.sh,

[root@localhost cron.daily] vi expire.sh
----------------------------------------
#!/usr/bin/python
python /etc/cron.daily/expire.py

----------------------------------------

But it is not working. Regarding crontab I have no idea. Sorry!!!

Regards,
Manoj
 
Old 03-09-2010, 06:37 AM   #8
giammy
Member
 
Registered: Feb 2010
Posts: 36

Rep: Reputation: 20
Quote:
Originally Posted by m4manoze View Post
Yes, I have call python script from bash as:

python file name : expire.py
bash script file name: expire.sh

In expire.sh,

[root@localhost cron.daily] vi expire.sh
----------------------------------------
#!/usr/bin/python
python /etc/cron.daily/expire.py

----------------------------------------

But it is not working. Regarding crontab I have no idea. Sorry!!!

Regards,
Manoj
this:
python /etc/cron.daily/expire.py
has not full path:
/usr/bin/python /etc/cron.daily/expire.py

bye
 
Old 03-09-2010, 10:52 AM   #9
freelinuxtutorials
Member
 
Registered: Oct 2009
Posts: 70

Rep: Reputation: 21
have you reloaded or restarted the crond service after adding it on /etc/cron.daily?
you can test your script if it will not generate errors by executing it directly /etc/cron.daily/filename
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
crond use aloisius-a Slackware 3 11-18-2009 11:05 AM
crond.d sang_froid General 3 03-23-2009 11:23 AM
/sbin/service crond unable to start - gives permission error on /usr/sbin/crond mgervacio Linux - Newbie 6 07-16-2008 02:03 PM
Crond jimval7 Linux - General 2 03-06-2002 12:28 PM
Shutting up Crond mikeyt_333 Linux - General 9 12-03-2001 01:46 PM


All times are GMT -5. The time now is 10:22 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration