how to run a script before execute a dbus-send command?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I have the following problem: on lubuntu 16.04 I can send the laptop to sleep (suspend on RAM) using a hook script to switch to a virtual teminal before to suspend and reswitching out from a vt after suspend
/etc/pm/sleep.d/01_switchvt



cat /etc/pm/sleep.d/01_switchvt
#!/bin/sh

# Switch to a VC before suspending and back after resume

case "$1" in
resume|thaw)
chvt 7
;;
suspend|hibernate)
chvt 1
;;
esac


but when I execute (and also the lxdesession-logout does) the dbus command



dbus-send --session --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend


the hook script is not executed and the system does not wake-up properly (blank screen and need to reboot from vt1)
Please I apreciate any kind of help,
thanks in advance
Francesco







share|improve this question

























    up vote
    1
    down vote

    favorite












    I have the following problem: on lubuntu 16.04 I can send the laptop to sleep (suspend on RAM) using a hook script to switch to a virtual teminal before to suspend and reswitching out from a vt after suspend
    /etc/pm/sleep.d/01_switchvt



    cat /etc/pm/sleep.d/01_switchvt
    #!/bin/sh

    # Switch to a VC before suspending and back after resume

    case "$1" in
    resume|thaw)
    chvt 7
    ;;
    suspend|hibernate)
    chvt 1
    ;;
    esac


    but when I execute (and also the lxdesession-logout does) the dbus command



    dbus-send --session --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend


    the hook script is not executed and the system does not wake-up properly (blank screen and need to reboot from vt1)
    Please I apreciate any kind of help,
    thanks in advance
    Francesco







    share|improve this question





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have the following problem: on lubuntu 16.04 I can send the laptop to sleep (suspend on RAM) using a hook script to switch to a virtual teminal before to suspend and reswitching out from a vt after suspend
      /etc/pm/sleep.d/01_switchvt



      cat /etc/pm/sleep.d/01_switchvt
      #!/bin/sh

      # Switch to a VC before suspending and back after resume

      case "$1" in
      resume|thaw)
      chvt 7
      ;;
      suspend|hibernate)
      chvt 1
      ;;
      esac


      but when I execute (and also the lxdesession-logout does) the dbus command



      dbus-send --session --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend


      the hook script is not executed and the system does not wake-up properly (blank screen and need to reboot from vt1)
      Please I apreciate any kind of help,
      thanks in advance
      Francesco







      share|improve this question











      I have the following problem: on lubuntu 16.04 I can send the laptop to sleep (suspend on RAM) using a hook script to switch to a virtual teminal before to suspend and reswitching out from a vt after suspend
      /etc/pm/sleep.d/01_switchvt



      cat /etc/pm/sleep.d/01_switchvt
      #!/bin/sh

      # Switch to a VC before suspending and back after resume

      case "$1" in
      resume|thaw)
      chvt 7
      ;;
      suspend|hibernate)
      chvt 1
      ;;
      esac


      but when I execute (and also the lxdesession-logout does) the dbus command



      dbus-send --session --dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend


      the hook script is not executed and the system does not wake-up properly (blank screen and need to reboot from vt1)
      Please I apreciate any kind of help,
      thanks in advance
      Francesco









      share|improve this question










      share|improve this question




      share|improve this question









      asked 2 days ago









      Francesco Lazzarotto

      61




      61

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          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: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460482%2fhow-to-run-a-script-before-execute-a-dbus-send-command%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460482%2fhow-to-run-a-script-before-execute-a-dbus-send-command%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?