• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

What's the difference between background and foreground commands?

Instructions
8
23
38.4k
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.
  • R
    Russ
    last edited by Russ Jun 2, 2020, 10:54 PM Apr 8, 2017, 9:35 PM

    The background agent adds, removes, and runs background commands only.
    The foreground agent adds, removes, and runs foregound commands only.

    On Windows, background commands run in the context of the Background Service, so they run as the Local System account by default. The background commands can't display things on your screen, but because they run as the Local System account they have full access to your PC, so they can do things like reboot or stop/start other services. Also, the service starts when you boot your PC, so you don't have to be logged in for the background commands to run. Background commands won't even show up on the triggercmd.com site until you install the background service.

    On Linux it works similarly, but background commands run as root, in the context of the triggercmdagent systemd daemon after installing it with the installdaemon.sh script.

    Background commands don't work on Macs at this point because I haven't written a background service/daemon for Macs yet.

    Russell VanderMey

    A 1 Reply Last reply Feb 18, 2023, 11:41 AM Reply Quote 0
    • M
      MNPG
      last edited by Dec 30, 2018, 4:53 AM

      For the macOS application, I had set the trigger to run as background, without reading this first. It caused the trigger to not show up in the web interface until I set it to foreground.

      Would it be possible to remove the background option for the macOS app to avoid confusing people?

      R T 2 Replies Last reply Dec 31, 2018, 12:16 AM Reply Quote 0
      • R
        Russ @MNPG
        last edited by Russ Feb 24, 2019, 3:42 PM Dec 31, 2018, 12:16 AM

        @mnpg, that's a good idea. I'll add that to my todo list and try to do it soon.

        EDIT 1/5/2019: It's done in the latest version of the mac agent as of today. Now on a mac you can only select Foreground when you add commands.

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • T
          tioinfo @MNPG
          last edited by Jun 30, 2020, 10:56 AM

          @MNPG hello could give an example of command how to open app and website on mac

          R 1 Reply Last reply Jun 30, 2020, 10:46 PM Reply Quote 0
          • R
            Russ @tioinfo
            last edited by Russ Jun 30, 2020, 10:55 PM Jun 30, 2020, 10:46 PM

            @tioinfo, this command should work:

            open https://google.com
            

            I added it to the examples for macs.

            Russell VanderMey

            1 Reply Last reply Reply Quote 0
            • S
              Sergio Gryciuk
              last edited by Jul 5, 2020, 6:01 PM

              hello could you give an example command to turn off my Imac and tried this "shutdown / s / t 2" in foreground and it doesn't work.

              R 1 Reply Last reply Jul 7, 2020, 12:25 AM Reply Quote 0
              • R
                Russ @Sergio Gryciuk
                last edited by Jul 7, 2020, 12:25 AM

                @Sergio-Gryciuk, I actually recently added Shutdown and a few other Mac examples to GUI Editor's example list. Here it is too:

                osascript -e 'tell app "System Events" to shut down'
                

                Russell VanderMey

                1 Reply Last reply Reply Quote 0
                • S
                  Sergio Gryciuk
                  last edited by Jul 9, 2020, 2:37 PM

                  Muchas gracias Russ, eres un genio el comando de apagar mi mac funciono perfectamente.

                  R 1 Reply Last reply Jul 9, 2020, 10:29 PM Reply Quote 1
                  • R
                    Russ @Sergio Gryciuk
                    last edited by Jul 9, 2020, 10:29 PM

                    Awesome @Sergio-Gryciuk, you're welcome.

                    Russell VanderMey

                    1 Reply Last reply Reply Quote 0
                    • K
                      Kingnabis
                      last edited by Oct 29, 2020, 5:08 PM

                      I have a question because i cant difference or i dont see the difference about it.
                      i have two comands, foreground and background one. Both make same (on windows 10) i have a shutdown /s /t 10 and both make same. Maybe this is only for Mac os users usefull?
                      But basically i cant run apps (native apps), like notepad.exe (foreground of course, but any of two works for me)
                      I tell on spanish Alexa, open (or run, or nothing, only /notepad/ or /noutpad/ both spechs works) notepad. And it sounds like the comand its suscesfully done but nothnig appears on screen.
                      Whats my issue?

                      R 1 Reply Last reply Oct 29, 2020, 10:34 PM Reply Quote 0
                      • R
                        Russ @Kingnabis
                        last edited by Russ Oct 29, 2020, 10:35 PM Oct 29, 2020, 10:34 PM

                        @Kingnabis, you're saying you can not run notepad, correct?

                        I recommend that you try using the TRIGGERcmd Smart Home Alexa skill. It recognizes your voice commands better because it has a list of what you might say ahead of time, so Alexa only has to match up what you say with something in that list.

                        Is your notepad command setup like this?
                        5b23d63b-a007-4934-ad72-e78e3ace7184-image.png

                        When you click the View Runs button,
                        a2da75b0-2587-48e7-af9f-b2ad6400c439-image.png

                        do you get a Command ran entry in your list?
                        21bdba44-6753-4fbd-b107-97c14f196d0c-image.png

                        Russell VanderMey

                        1 Reply Last reply Reply Quote 1
                        • K
                          Kingnabis
                          last edited by Oct 30, 2020, 12:03 AM

                          Yes, mine was like yours but i was jumping the COMAND part. I need to add START previously to notepad... I udapted like this and it works. I have to write it on cmd, if works there works from the skill. asdge.PNG

                          1 Reply Last reply Reply Quote 0
                          • K
                            Kingnabis
                            last edited by Oct 30, 2020, 12:25 AM

                            ahoraci.PNG

                            1 Reply Last reply Reply Quote 0
                            • A
                              adriangcamacho
                              last edited by adriangcamacho Mar 9, 2021, 8:11 PM Mar 9, 2021, 8:11 PM

                              Hi, any solution to run background commands in mac os?

                              R 1 Reply Last reply Mar 9, 2021, 11:52 PM Reply Quote 0
                              • R
                                Russ @adriangcamacho
                                last edited by Mar 9, 2021, 11:52 PM

                                @Adrián-González-Camacho, not yet. I didn't think many Mac users would want to use it. Do you want this feature so you can run commands while you're not logged on? Just curious what your use-case is.

                                Russell VanderMey

                                A 1 Reply Last reply Mar 11, 2021, 7:52 PM Reply Quote 0
                                • A
                                  adriangcamacho @Russ
                                  last edited by Mar 11, 2021, 7:52 PM

                                  @Russ I want to use my mac as a server and launch home automation commands

                                  R 1 Reply Last reply Mar 11, 2021, 11:52 PM Reply Quote 1
                                  • R
                                    Russ @adriangcamacho
                                    last edited by Mar 11, 2021, 11:52 PM

                                    @adriangcamacho, I see. I assume you don't want to leave it logged in?

                                    I'll have to research again how to create services that startup at boot time on a Mac.

                                    Russell VanderMey

                                    A 1 Reply Last reply Mar 15, 2021, 11:40 AM Reply Quote 1
                                    • A
                                      adriangcamacho @Russ
                                      last edited by Mar 15, 2021, 11:40 AM

                                      @Russ Yep, thank you a lot for your time.
                                      If you need some help i think i could help you i'm backend developer.

                                      1 Reply Last reply Reply Quote 0
                                      • TuneyLunesT
                                        TuneyLunes
                                        last edited by Mar 28, 2021, 4:09 PM

                                        I'd also like to use my mac as an automation server and it would be easier to not have to be logged in permanently. Thanks @Russ !

                                        R 1 Reply Last reply Mar 28, 2021, 7:03 PM Reply Quote 0
                                        • R
                                          Russ @TuneyLunes
                                          last edited by Mar 28, 2021, 7:03 PM

                                          @TuneyLunes, I haven't built this into the Mac agent yet, so for now you can use this method to setup the background agent on a Mac.

                                          Russell VanderMey

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post