LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 05: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, 05: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, 07: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, 12: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, 12:25 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

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, 02: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, 05: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, 05: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, 09: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 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