Using Cron to stap and restart IPSEC service
-
Hi again,
Sorry, I am not sure what to adjust, and how to split it into the two files that I would need.
I will keep on searching the forums and see if anyone else has had similar requirements.
Thanks,
Stu -
As I told you on last post, there is no need to edit the script.
Here is an example:
192.168.1.1 exist in your network
192.168.1.50 Does not exist.To enable my IPSec I run at console or via cron
Php -q /var/www/check_IPSec.php 192.168.1.50
To disable
Php -q /var/www/check_IPSec.php 192.168.1.1
-
OK, sorry, I didn't quite understand. I thought I had to edit the script and insert the IP addresses there.
Thanks very much for clearing that up. I will try it tonight when everyone has logged off their systems.
-
Hello again!
I have finally had a chance to try and implement this before the holidays.
I can successfully run these commands via the shell:
php -q /root/PHPipsec.php 192.168.200.250 (This stops IPSEC as IP does ping)
php -q /root/PHPipsec.php 192.168.200.251 (This starts IPSEC as IP does not ping)I am unable to schedule via Cron though, nothing seems to happen, I have setup my Cron task like this:
16 / 9 / * / * / * / root / php -q /root/PHPipsec.php 192.168.200.250
18 / 9 / * / * / * / root / php -q /root/PHPipsec.php 192.168.200.251Could anyone assist with why this is running in teh shell, but not via cron? I really don't feel like restarting the ipsec service manually every day for the next 3 weeks while I am on leave :)
Thanks very much!
Stu -
Use php full path.
Find it with find / -name php
-
Hi,
I ran that from the shell. I get this:
[2.0-RELEASE][root@testpfsense.testlocaldomain]/root(4): find / -PHPipsec php
find: -PHPipsec: unknown optionAm I typing something wrong?
-
Update -
I typed it in correctly and get this as a result:
[2.0-RELEASE][root@testpfsense.testlocaldomain]/root(7): find / -name PHPipsec.php
/root/PHPipsec.phpThat is what I am using in my Cron job though. Should I try move it out of the root folder? Maybe Cron doesn't like running the script from there?
Thanks again!
Stu -
No, that didn't do it…
My task now looks like this, but still didn't work:
51 9 * * * root php -q /sbin/PHPipsec.php 192.168.200.250
Still, when I copy and past into my SSH session to the shell. It works perfectly.
So frustrating.
Stu
-
use this way in cron:
0 4 * * * root /usr/local/bin/php -q /sbin/PHPipsec.php
-
Thanks you very much, that did it! I can now go on holiday and not have to manually restart Racoon every night/morning.
Merry Christmas and Happy new year!
Thanks again, that's awesome.
Stu -
I would like to try to use this method to restart my ipsec vpn since it seems to quit working after 4 or 5 hours.
When I do; find / -name PHPipsec.php I get nothing, it would appear that I don't have this on my install (pfsense 2.0.1-RELEASE (amd64) ). I can stop and start racoon from the "Status:Services" page.
Any help would be very appreciated.
Thanks in advance
Mike
-
The second post of this thread shows the link to script thread.
You can use the script on this topic with few modifications.
http://forum.pfsense.org/index.php/topic,42025.0.html