Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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
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!!!
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.