How to restart racoon service via shell script?



  • I've customized script which ping GRE endpoint inside ipsec tunnel. I would like to restart racoon in case GRE endpoint is not reachable via script using

    pfSsh.php playback svc stop racoon
    pfSsh.php playback svc start racoon

    when i put those lines into script it seems OK - i've got informational message - below - about it, but in reality it looks like those two lines do nothing? no ping is lost towards GRE endpoint for example

    –---
    Starting the pfSense shell system...............

    Attempting to issue stop to racoon service...

    racoon has been stopped.

    Starting the pfSense shell system...............

    Attempting to issue start to racoon service...

    racoon has been started.

    any ideas?

    add info:

    i've also tried to use this PHP instead of those two commands

    #!/usr/local/bin/php -q
    require_once('vpn.inc');
    vpn_ipsec_force_reload();
    ?>

    but got this error while executing, now I'm completely stuck

    Fatal error: Call to undefined function killbypid() in /etc/inc/vpn.inc on line 1026



  • working php for ipsec restart is

    #!/usr/local/bin/php -q

    require_once("util.inc");
    require_once("functions.inc");
    require_once("pkg-utils.inc");
    require_once("globals.inc");
    require_once("ipsec.inc");
    require_once("vpn.inc");
    require_once("service-utils.inc");
    require_once("vslb.inc");

    vpn_ipsec_force_reload();

    –---------
    i'm aware that few of listed are not needed at all



  • the "pfSsh.php playback svc start racoon" works for me, if I execute it from shell (PuTTY from my pc)

    when I issue this command, I can see in the system log: "php: pfSsh.php: Forcefully reloading IPsec racoon daemon" and after 3-4 lost pings, it pings again.

    Can you post your script, because I have the same problem with ipsec, and trying to solve it. But I'm really rookie in scripting.  ::)