Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to restart racoon service via shell script?

    Scheduled Pinned Locked Moved IPsec
    3 Posts 2 Posters 3.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bc2011
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • B
        bc2011
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • L
          la_bela
          last edited by

          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.  ::)

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.