Sunday, 11 January 2015

What happens to cronjobs scheduled when the server is off?

ravimanephpmysql

Question:I have an Ubuntu Server 12 which isn't on all day. In the /etc/crontab, I see that cron.daily, cron.weekly and cron.monthly are scheduled at times the server is off, usually.What happens with those tasks? Will they just be skipped, or runned as soon as the server is on again.



ANSWER:
cron skips jobs if it isn't running at the time that they are scheduled.

However, if you have anacron installed, then daily, weekly and monthly jobs are run "at the specified intervals as closely as machine uptime permits".

In /etc/crontab, you should see references to anacron. This logic uses anacron for regular jobs, but only if anacron is installed. anacron is installed by default on Ubuntu Desktop, but not on Server, since servers are generally expected to be on 24/7. But you can install anacron on Ubuntu Server if you want the same behaviour there, and it should work as expected.

Get only domain name from email using PHP.

public function getDomainName ( $business_email ){ $domain_name = substr ( strrchr ( $email , "@" ), 1 ); echo $...