GO HERE Where is the IP updater run from and how often?

JFrost

Active Member
Joined
Oct 1, 2016
Messages
351
Reaction score
93
On ipbx 13-13. I think it's the `ipchecker` script in the root that does the work of checking and whitelisting dynamic IPs (ie. cell phones and road-warriors).
But where is it run from? I checked the crons and don't see it.
And how often? I'd like to step it up so there is less delay.

thanks.
 

JFrost

Active Member
Joined
Oct 1, 2016
Messages
351
Reaction score
93
Interesting. Still pretty novice at linux. I did a `crontab -l` as root and it came back blank. I guess that's not the same as just `cat`ing the /etc/crontab.
 

JFrost

Active Member
Joined
Oct 1, 2016
Messages
351
Reaction score
93
Yes, well. Let's ignore the snark and call it humor. That's what I searched, that's what I found. And yet still the question remained unanswered.

So while I appreciate the thought you should really vet your lmgtfy search results next time. Those results don't answer this question - or at least nothing in the first 5 results does. Of course if you'd checked instead of off-hand snarked, you'd have caught that.

The crontab COMMAND does not return the results of simply `cat`ing the \etc\crontab file in this case.
Hence my follow up comment stating so.
 

mainenotarynet

Not really a Guru - Just a long time user
Joined
May 29, 2010
Messages
754
Reaction score
155
I'm new to linux (sort of) also, know how to copy and Past commands :smile5: -- but I have read that there is crontab, and there is crontab. Huh? each user has their own crontab also (I believe you see that as crontab -e (?) the one where root uses has all the scrips that run and that's the /etc/crontab -- I usually look at that through nano /etc/crontab in this way if I want to add or edit it, it's already open for that.
 

kenn10

Well-Known Member
Joined
Dec 16, 2007
Messages
3,764
Reaction score
2,173
Unless it has been automated in later releases of IncrediblePBX, I believe you have to add ipchecker to the crontab yourself using update intervals of your choice. Going back a few years where whitelist inclusion began, here is Ward's initial post on Travelin' Man 3: http://nerdvittles.com/?p=815

You can directly edit the crontab file but, for safety, I prefer to use
Code:
crontab - e -u root
to add/edit entries that are not directly related to Asterisk/FreePBX.

The default entries set up by IncrediblePBX installs are at
Code:
crontab -l -u asterisk

Directly editing the /etc/crontab file may not reveal all the scheduled jobs in your system and you could end up with duplicates or conflicting entries. However, as user root, you can directly edit /etc/crontab and that may reveal whether ipchecker is already scheduled by the installer.

Also, individual crontabs for users live in /var/spool/cron/.
 
Last edited:

jerrm

Guru
Joined
Sep 23, 2015
Messages
838
Reaction score
405
Cron is a mess IMO. To find where (or if) a job is scheduled requires checking at least half a dozen locations.

A (very) quick and dirty script I use to find things:
Code:
#!/bin/bash

b="======================================================================="
for e in `find /etc/cron.*/* /var/spool/cron/* /etc/*crontab`
  do
    [ -f $e ] && {
      echo "${b:0:${#e}}"
      echo "$e"
      echo "${b:0:${#e}}"
      cat $e | grep ".$1"
      echo -e "\n"  
    }
done

It ain't pretty, but makes finding things easier.
 
Last edited:

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Correct. Decoder badge: run ipchecker every 10 minutes between 5 am and 10 pm every day.
 

JFrost

Active Member
Joined
Oct 1, 2016
Messages
351
Reaction score
93
Cron is a mess IMO. To find where (or if) a job is scheduled requires checking at least half a dozen locations.

A (very) quick and dirty script I use to find things:
Code:
#!/bin/bash

b="======================================================================="
for e in `find /etc/cron.*/* /var/spool/cron/* /etc/*crontab`
  do
    [ -f $e ] && {
      echo "${b:0:${#e}}"
      echo "$e"
      echo "${b:0:${#e}}"
      cat $e | grep ".$1"
      echo -e "\n" 
    }
done

It ain't pretty, but makes finding things easier.

I just ran your command against my system and ffs that's a lot of crons! Who knew. That really is a mess.

Thanks for the script.
 

JFrost

Active Member
Joined
Oct 1, 2016
Messages
351
Reaction score
93
Unless it has been automated in later releases of IncrediblePBX, I believe you have to add ipchecker to the crontab yourself using update intervals of your choice.

I think it's clearly been automated in IPBX. I didn't add it or I'd have known where I put it.

And the 'add-fqdn' and 'add-ip' scripts included in IPBX wouldn't do anything without something somewhere running the ipchecker script periodically.
 

JFrost

Active Member
Joined
Oct 1, 2016
Messages
351
Reaction score
93
Correct. Decoder badge: run ipchecker every 10 minutes between 5 am and 10 pm every day.

I'd like to run this every 1 minute. For some reason it takes a fairly long time (like 5 or 6 minutes solid) for iptables to shut down on my system.
  • Is there a problem with running it this often?
  • Anyway to speed up the iptables shutdown/restart process (I wonder if my system is exposed during this time)
  • How long does it take for iptables to shutdown on your (typical) system? (I'm on a vultr vps - 1GB ram, 25GB SSD - I don't think it's a resource issue)
thx.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
If there's no change in the IP address, the ipchecker script exits immediately without doing anything else. The problem is ipchecker would be hammering the IP lookup site and your server may get blocked permanently.
 

Members online

No members online now.

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top