I have a problem with cron job on my ubuntu server 12.04. I have two internet providers - one for fast speed, second - for local resources. So, I'm using command route to up the static routing for second provider. But the point is that the dhclient asking every ~1500 seconds new routing from provider and set it up.
Sep 14 18:00:57 ubuntu dhclient: DHCPREQUEST of 10.166.132.69 on eth2 to 80.73.64.167 port 67
Sep 14 18:00:57 ubuntu dhclient: DHCPNAK from 80.73.64.167
Sep 14 18:00:57 ubuntu dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 3
Sep 14 18:00:58 ubuntu dhclient: DHCPREQUEST of 10.166.132.69 on eth2 to 255.255.255.255 port 67
Sep 14 18:00:58 ubuntu dhclient: DHCPOFFER of 10.166.132.69 from 80.73.64.167
Sep 14 18:00:58 ubuntu dhclient: DHCPACK of 10.166.132.69 from 80.73.64.167
Sep 14 18:00:58 ubuntu dhclient: bound to 10.166.132.69 -- renewal in 1443 seconds.
So I think cron can help me to solve this problem. I know this is not the best way. But this is all that I could think of.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/5 * * * * root /etc/network/if-up.d/route-eth2 > /tmp/otchetcron
*/5 * * * * root /home/route.sh > /tmp/otchet
All files are executable.
-rwxr-xr-x 1 root root 1,2K авг. 29 21:50 /etc/network/if-up.d/route-eth2
-rwxr-xr-x 1 root root 1,2K сент. 5 23:15 route.sh
in output files otchet and otchetcron is nothing. They just empty. In syslog I saw this:
Sep 19 18:25:01 ubuntu CRON[9105]: (root) CMD (root /etc/network/if-up.d/route-eth2 > /tmp/otchetcron)
Sep 19 18:25:01 ubuntu CRON[9106]: (root) CMD (root /etc/cron.d/route.sh > /tmp/otchet)
Sep 19 18:25:01 ubuntu CRON[9104]: (CRON) info (No MTA installed, discarding output)
Sep 19 18:25:01 ubuntu CRON[9103]: (CRON) info (No MTA installed, discarding output)
So If you have the other ways to solve it. Please give me an advice.