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

    Trouble exciting script in both ssh and Diagnostics>Command Prompt.

    Scheduled Pinned Locked Moved webGUI
    8 Posts 3 Posters 407 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.
    • V
      VMlabman
      last edited by

      Hi,

      Trouble exciting script in both ssh and Diagnostics>Command Prompt. I have a script I will share below that will start a Pcap for 15 Min and save the file to /capsave/wan. I am not able to excite the filename.sh file with ./filename.sh. I have performed a chmod +x filename/sh on the in it’s location capasver/scripts. After I am able to test this script I am going to add it to cron and have it randomly run several times day. Ways I have attempted to execute the script from ./filename.sh from directory the script is located in ./filename.sh. I have tried ./capseve/scripts/filename.sh from with in the directory of the file location and from the root ./ and from ./root So my syntax / location. is not correct. Help with this would make my day better. Screenshots below.

      Script: one15minpcap.sh

      #!/bin/sh

      Log script start time

      echo "Starting WAN capture at $(date)"

      Capture WAN Interface for 5 minutes

      /usr/sbin/tcpdump -i wan -w /capsave/wan/wan_capture_$(date +"%Y-%m-%d_%H-%M-%S").pcap -s 0 -W 1 -Z root -e &

      Sleep for 5 minutes

      sleep 300

      Log script end time

      echo "WAN capture completed at $(date)"

      ssh_.png gui_cmd_pt.png

      S johnpozJ 2 Replies Last reply Reply Quote 0
      • S
        SteveITS Galactic Empire @VMlabman
        last edited by

        @VMlabman A script or command run in the web GUI has to exit on its own. Otherwise it will wait in the background forever.

        Your post says "excite" a couple of times, did you mean "execute" or "exit"?

        In your image, capture_script.sh is marked executable but not readable.

        Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
        When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
        Upvote 👍 helpful posts!

        V 1 Reply Last reply Reply Quote 0
        • V
          VMlabman @SteveITS
          last edited by VMlabman

          @SteveITS

          I am looking at the file permissions: -rwxr-xr-x 1 root wheel 320 May 3 11:06 one15minpcapwan.sh depicted in a screenshot below. I am an newbie can you tell me what command I would run to make this readable correctly and executing as a script for later use in crontab.
          To answer your question regarding exaction one x
          @SteveITS said in Trouble executing script in both ssh and Diagnostics>Command Prompt.:
          Your post says "excite" a couple of times, did you mean "execute" or "exit"?
          I am referring to execute.

          file per-01.png

          S 1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator @VMlabman
            last edited by

            @VMlabman said in Trouble exciting script in both ssh and Diagnostics>Command Prompt.:

            tcpdump -i wan

            For one that is not a valid interface.. You would need to use like igb0 or em1 or eth0 or ix0, etc.. whatever your actual wan interface is.

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            • S
              SteveITS Galactic Empire @VMlabman
              last edited by

              @VMlabman do you get an error when you run the script?

              Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
              When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
              Upvote 👍 helpful posts!

              johnpozJ 1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @SteveITS
                last edited by

                @SteveITS looks like it to me, from his posting

                error.jpg

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.8, 24.11

                S 1 Reply Last reply Reply Quote 0
                • S
                  SteveITS Galactic Empire @johnpoz
                  last edited by

                  @johnpoz said in Trouble exciting script in both ssh and Diagnostics>Command Prompt.:

                  from his posting

                  That would mean the script is running though. And then the error would presumably be "wan" as you pointed out.

                  Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                  When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                  Upvote 👍 helpful posts!

                  johnpozJ 1 Reply Last reply Reply Quote 0
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator @SteveITS
                    last edited by

                    @SteveITS true the script did execute ;)

                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                    If you get confused: Listen to the Music Play
                    Please don't Chat/PM me for help, unless mod related
                    SG-4860 24.11 | Lab VMs 2.8, 24.11

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