pkill vpn terminates all my script











up vote
0
down vote

favorite












I am working with a Dialog GUI.



./sdvpn.sh is the code for the GUI main menu, shown below.



./killvpn.sh is a script containing only one command, sudo pkill vpn



./region.sh is a Dialog menu allowing to specify the country you desire your VPN to connect to.



When I want to kill any active OpenVPN connections, I select option 2 on the menu below:



`#!/bin/bash

#Main Menu

HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="VPN"
TITLE="Main Menu"
MENU="Choose an Option: "

OPTIONS=(1 "VPN Menu"
2 "Kill Active VPN")

CHOICE=$(dialog --clear
--backtitle "$BACKTITLE"
--title "$TITLE"
--menu "$MENU"
$HEIGHT $WIDTH $CHOICE_HEIGHT
"${OPTIONS[@]}"
2>&1 >/dev/tty)

clear
case $CHOICE in
1)
cd ~/VPN/gui
./region.sh
;;
2)
cd ~/VPN/scripts
./killvpn.sh
cd ~/VPN
./sdvpn.sh
;;

esac`


This code for Option 2 is supposed to achieve the following:




  • lead to my Scripts directory

  • Exectute sudo pkill vpn

  • Return to the main folder where my main menu.sh is kept

  • Run the main menu, taking the process full circle.


The Problem



It will not return to the main menu, and I have no way to troubleshoot this. The same methodology worked perfectly when rolled out on Kali Linux 2018.2.



When I execute sudo pkill vpn or my killvpn.sh file, it simply kills the VPN connections as expected. However when running the same script from the Dialog GUI, I receive a message which says "Terminated."



I have tried rerouting the killvpn.sh to activate the Dialog GUI as part of its script, but the same problem occured.
I have then tried, with both sudo pkill vpn and killvpn.sh to include the sleep command, as I was simply returned to the terminal, and believed this was a process it could execute in order to continue running the code, but this failed too.



I am now unable to kill the VPN from my GUI, and I would like to know if there was a way I can either remove the "Terminated." message, or a way to accomplish my task. As a bonus ball, I would be grateful if someone could explain to me under what conditions will pkill vpn display this message, so I can avoid it in the future.










share|improve this question


























    up vote
    0
    down vote

    favorite












    I am working with a Dialog GUI.



    ./sdvpn.sh is the code for the GUI main menu, shown below.



    ./killvpn.sh is a script containing only one command, sudo pkill vpn



    ./region.sh is a Dialog menu allowing to specify the country you desire your VPN to connect to.



    When I want to kill any active OpenVPN connections, I select option 2 on the menu below:



    `#!/bin/bash

    #Main Menu

    HEIGHT=15
    WIDTH=40
    CHOICE_HEIGHT=4
    BACKTITLE="VPN"
    TITLE="Main Menu"
    MENU="Choose an Option: "

    OPTIONS=(1 "VPN Menu"
    2 "Kill Active VPN")

    CHOICE=$(dialog --clear
    --backtitle "$BACKTITLE"
    --title "$TITLE"
    --menu "$MENU"
    $HEIGHT $WIDTH $CHOICE_HEIGHT
    "${OPTIONS[@]}"
    2>&1 >/dev/tty)

    clear
    case $CHOICE in
    1)
    cd ~/VPN/gui
    ./region.sh
    ;;
    2)
    cd ~/VPN/scripts
    ./killvpn.sh
    cd ~/VPN
    ./sdvpn.sh
    ;;

    esac`


    This code for Option 2 is supposed to achieve the following:




    • lead to my Scripts directory

    • Exectute sudo pkill vpn

    • Return to the main folder where my main menu.sh is kept

    • Run the main menu, taking the process full circle.


    The Problem



    It will not return to the main menu, and I have no way to troubleshoot this. The same methodology worked perfectly when rolled out on Kali Linux 2018.2.



    When I execute sudo pkill vpn or my killvpn.sh file, it simply kills the VPN connections as expected. However when running the same script from the Dialog GUI, I receive a message which says "Terminated."



    I have tried rerouting the killvpn.sh to activate the Dialog GUI as part of its script, but the same problem occured.
    I have then tried, with both sudo pkill vpn and killvpn.sh to include the sleep command, as I was simply returned to the terminal, and believed this was a process it could execute in order to continue running the code, but this failed too.



    I am now unable to kill the VPN from my GUI, and I would like to know if there was a way I can either remove the "Terminated." message, or a way to accomplish my task. As a bonus ball, I would be grateful if someone could explain to me under what conditions will pkill vpn display this message, so I can avoid it in the future.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am working with a Dialog GUI.



      ./sdvpn.sh is the code for the GUI main menu, shown below.



      ./killvpn.sh is a script containing only one command, sudo pkill vpn



      ./region.sh is a Dialog menu allowing to specify the country you desire your VPN to connect to.



      When I want to kill any active OpenVPN connections, I select option 2 on the menu below:



      `#!/bin/bash

      #Main Menu

      HEIGHT=15
      WIDTH=40
      CHOICE_HEIGHT=4
      BACKTITLE="VPN"
      TITLE="Main Menu"
      MENU="Choose an Option: "

      OPTIONS=(1 "VPN Menu"
      2 "Kill Active VPN")

      CHOICE=$(dialog --clear
      --backtitle "$BACKTITLE"
      --title "$TITLE"
      --menu "$MENU"
      $HEIGHT $WIDTH $CHOICE_HEIGHT
      "${OPTIONS[@]}"
      2>&1 >/dev/tty)

      clear
      case $CHOICE in
      1)
      cd ~/VPN/gui
      ./region.sh
      ;;
      2)
      cd ~/VPN/scripts
      ./killvpn.sh
      cd ~/VPN
      ./sdvpn.sh
      ;;

      esac`


      This code for Option 2 is supposed to achieve the following:




      • lead to my Scripts directory

      • Exectute sudo pkill vpn

      • Return to the main folder where my main menu.sh is kept

      • Run the main menu, taking the process full circle.


      The Problem



      It will not return to the main menu, and I have no way to troubleshoot this. The same methodology worked perfectly when rolled out on Kali Linux 2018.2.



      When I execute sudo pkill vpn or my killvpn.sh file, it simply kills the VPN connections as expected. However when running the same script from the Dialog GUI, I receive a message which says "Terminated."



      I have tried rerouting the killvpn.sh to activate the Dialog GUI as part of its script, but the same problem occured.
      I have then tried, with both sudo pkill vpn and killvpn.sh to include the sleep command, as I was simply returned to the terminal, and believed this was a process it could execute in order to continue running the code, but this failed too.



      I am now unable to kill the VPN from my GUI, and I would like to know if there was a way I can either remove the "Terminated." message, or a way to accomplish my task. As a bonus ball, I would be grateful if someone could explain to me under what conditions will pkill vpn display this message, so I can avoid it in the future.










      share|improve this question













      I am working with a Dialog GUI.



      ./sdvpn.sh is the code for the GUI main menu, shown below.



      ./killvpn.sh is a script containing only one command, sudo pkill vpn



      ./region.sh is a Dialog menu allowing to specify the country you desire your VPN to connect to.



      When I want to kill any active OpenVPN connections, I select option 2 on the menu below:



      `#!/bin/bash

      #Main Menu

      HEIGHT=15
      WIDTH=40
      CHOICE_HEIGHT=4
      BACKTITLE="VPN"
      TITLE="Main Menu"
      MENU="Choose an Option: "

      OPTIONS=(1 "VPN Menu"
      2 "Kill Active VPN")

      CHOICE=$(dialog --clear
      --backtitle "$BACKTITLE"
      --title "$TITLE"
      --menu "$MENU"
      $HEIGHT $WIDTH $CHOICE_HEIGHT
      "${OPTIONS[@]}"
      2>&1 >/dev/tty)

      clear
      case $CHOICE in
      1)
      cd ~/VPN/gui
      ./region.sh
      ;;
      2)
      cd ~/VPN/scripts
      ./killvpn.sh
      cd ~/VPN
      ./sdvpn.sh
      ;;

      esac`


      This code for Option 2 is supposed to achieve the following:




      • lead to my Scripts directory

      • Exectute sudo pkill vpn

      • Return to the main folder where my main menu.sh is kept

      • Run the main menu, taking the process full circle.


      The Problem



      It will not return to the main menu, and I have no way to troubleshoot this. The same methodology worked perfectly when rolled out on Kali Linux 2018.2.



      When I execute sudo pkill vpn or my killvpn.sh file, it simply kills the VPN connections as expected. However when running the same script from the Dialog GUI, I receive a message which says "Terminated."



      I have tried rerouting the killvpn.sh to activate the Dialog GUI as part of its script, but the same problem occured.
      I have then tried, with both sudo pkill vpn and killvpn.sh to include the sleep command, as I was simply returned to the terminal, and believed this was a process it could execute in order to continue running the code, but this failed too.



      I am now unable to kill the VPN from my GUI, and I would like to know if there was a way I can either remove the "Terminated." message, or a way to accomplish my task. As a bonus ball, I would be grateful if someone could explain to me under what conditions will pkill vpn display this message, so I can avoid it in the future.







      command-line bash scripts vpn openvpn






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 16:53









      tREEs

      19514




      19514






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          In this case, I found that using the command
          sudo killall openvpn was both a more effective way of terminating OpenVPN Connections, and also avoided the dialog I got with sudo pkill vpn allowing me to return to the dialog menu without any issues.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095158%2fpkill-vpn-terminates-all-my-script%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            In this case, I found that using the command
            sudo killall openvpn was both a more effective way of terminating OpenVPN Connections, and also avoided the dialog I got with sudo pkill vpn allowing me to return to the dialog menu without any issues.






            share|improve this answer

























              up vote
              0
              down vote













              In this case, I found that using the command
              sudo killall openvpn was both a more effective way of terminating OpenVPN Connections, and also avoided the dialog I got with sudo pkill vpn allowing me to return to the dialog menu without any issues.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                In this case, I found that using the command
                sudo killall openvpn was both a more effective way of terminating OpenVPN Connections, and also avoided the dialog I got with sudo pkill vpn allowing me to return to the dialog menu without any issues.






                share|improve this answer












                In this case, I found that using the command
                sudo killall openvpn was both a more effective way of terminating OpenVPN Connections, and also avoided the dialog I got with sudo pkill vpn allowing me to return to the dialog menu without any issues.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 at 17:06









                tREEs

                19514




                19514






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095158%2fpkill-vpn-terminates-all-my-script%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido