I have debian squeeze installed on my box. I have BIRD daemon to route traffic of particular IP. We add IP to bird-route.conf
automatically from ruby script if traffic spikes up to specific range. I would like to know the possible ways to send notification of added IP to remove from bird-route.conf
after certain period, for example say If script adds the IP in bird-route.conf
file at 12.00AM so notification script should notify me after 48 hours to remove it. How can I achieve this ? shell, perl or ruby any of the scripting would work.
One mechanism for "delayed action" in Unix is at
. Some system administrators may disable its usage, but if it's available, it can help you solve your problem.
Your "add" script can add the IP, then fire off an
at
job that calls a "remove" script with the same IP as a parameter.Once the
at
job runs, it should check the target configuration to see if the given IP is still there (I'm not sure if your situation allows for the same IP to be "added" twice).
at
job to call a removal script of the same IP – Jeff Schaller♦ Mar 25 '16 at 21:40at
isn't installed, just run the removal or notification script after asleep 2d
(orsleep 172800
if your version of sleep doesn't understand thed
suffix for days). – cas Mar 25 '16 at 22:53