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.
I have been using Linux systems for a number of years and have delt in many platforms including Ubuntu, Kubuntu ontop of that, Fedora and also some private based images.
Basically what it is yeah, i have some web hosting on a linux based Apache web server and have only recently started to look into using the crontab commands again (it has been a while since me using it when programming in Python).
The question i have is, i can set a cron off every hour and i will receive an e-mail about what has been executed etc. but what i wanted to know is, can i make the e-mail only be sent at midnight on the day? So the script runs 24 times in the day but i only get e-mailed from the Cron which runs at midnight.
The reason is, the web space that i rent only allows me to do one cron job and i am trying to find a way to execute it every hour but only send the e-mail for something once per day. Any solutions are great.
The Cron will be executing a cron.php file where part of this file will only execute at a certain time. I am familiar with PHP and the time functions if you think i could maybe do something with them to only send the e-mail out once a day. Just i am unsure how i can create a link in the cron.php file to e-mail out everything which is executed only at midnight.
Any suggestions are welcome...quite a puzzling question i thought for a first post from a new member lol. If this is in the wrong forum then can somebody move it please to the right section and any help is much appreciated as when doing a search on the net i have found nothing to help me with this.
Last edited by Sharkadder; 12-11-2012 at 05:47 PM.
the web space that i rent only allows me to do one cron job
per day ?? Seriously???
Personally I'd go elsewhere; that's ridiculous.
However, IF(!) I had to live with it I'd write a daemon to do the data gathering hourly and run the cron job once a day to send the email.
(Actually, rather than waste the cron job, I'd get the daemon to do the email as well)
Last edited by chrism01; 12-12-2012 at 05:30 PM.
Reason: typo
I shall look into this, the cron i have can be executed multiple times per day but i only have access to the one cron job. i.e. multiple sends but i cannot figure a way to do the cron every hour but only send the e-mail which comes with it once per day. Do you know how i can maybe resolve this? Don't think my shared hosting has access to a Daemon which is a shame, restricted access and all that etc. :-(.
Many thanks,
Mark
Last edited by Sharkadder; 12-12-2012 at 10:25 AM.
You could run a script that has different behaviour depending on factors like:
is it midnight (within a small interval)?
have I already got 23 stored outputs from previous runs?
I could do your suggestion but when you do a cron command the e-mail runs from the actual command and not through any form of PHP script. That why i wondered if there was any specific parameter attached to cron.
My con job currently looks like this to let it e-mail once every day but don't know a command to make it go off every hour and only e-mail once per day:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.