How to run a .sh file in terminal on loginStarting Xmodmap on login (12.10)Cannot add/edit/remove Startup Applications; Ubuntu 14.04 with UnityHow to set gxmessage to run at login, and make exit codes trigger eventsanother login loop problemHow do I associate a file type with an appimage?Startup application not working after loginActivating conda environment in “startup applications” script

Can a polling station shut early if everyone has voted?

Bushing OK or need clamp? NM-B 6/3 going into breaker box

Is the weight of the aircraft flying in the sky transferred to the ground?

Secure Implementation of Password Database

How to arrange objects in outward facing circle?

Why is the superlative of "nah" not "am nähsten" but "am nächsten"?

How does a soft landing technically work without air on the moon?

Can a public school in the USA force a 14yr old to create a Twitter account for a passing grade?

Can you wield a a typical shield and Aegis of the Raven Queen at the same time?

Unexpected large rent payments, by moneygram, for my apartment, not by me

Could the barycenter orbit of our sun be greatly underestimated?

Do multimedia speaker systems run on AC power rather than DC?

Six letter words from "MONSTER"

Is the net charge on a capacitor zero? If yes, then why?

Are there any spell casters that can cast life giving spells without 'expensive' components?

Is it appropriate to rewrite and republish another author's useful but very badly written paper?

Has any person or company ever become a sovereign state?

No transit zone at Linate airport. Couldn't get on connecting flight. Whose responsibility is it?

Would a uranium 235 fuel pellet the size of Earth explode?

Is harmlessly appearing to be a school bus driver a crime?

Mysql GROUP BY is really slow on a simple view

Why is there no No:6 in the movie?

Undesired blank space between some words

Running SXA Creative Exchange Import on build and release pipelines (CI / CD)



How to run a .sh file in terminal on login


Starting Xmodmap on login (12.10)Cannot add/edit/remove Startup Applications; Ubuntu 14.04 with UnityHow to set gxmessage to run at login, and make exit codes trigger eventsanother login loop problemHow do I associate a file type with an appimage?Startup application not working after loginActivating conda environment in “startup applications” script






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









1


















so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications. This didn't work. I tried editing the .desktop file for the startup application to set Terminal=true. This made it open temporarily but shut it down.
I tried editing .bashrc by adding the command bash /path/to/my/file.sh and it had the same effect. This seems like it should be really simple to do, even in linux, but I have tried lots of ways and had no success. I am on Ubuntu 14.something.










share|improve this question




















  • 1





    All of those methods should have worked (well, the .bashrc one is only on opening a Terminal; .profile would have been better). What are you doing inside the .sh file? Is the executable bit set? Does it start with #!/bin/bash?

    – saiarcot895
    Jul 3 '14 at 16:41












  • As @saiarcot895 you may forgot to give executable permissions to file.

    – Sudheer
    Jul 3 '14 at 16:43











  • You would be able to find out what filetype it is set to by typing in ls -la

    – ryekayo
    Jul 3 '14 at 16:49











  • Please edit your post and include the script in question. Also, please clarify if you want this to run for a single user or for all users.

    – terdon
    Jul 3 '14 at 16:53

















1


















so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications. This didn't work. I tried editing the .desktop file for the startup application to set Terminal=true. This made it open temporarily but shut it down.
I tried editing .bashrc by adding the command bash /path/to/my/file.sh and it had the same effect. This seems like it should be really simple to do, even in linux, but I have tried lots of ways and had no success. I am on Ubuntu 14.something.










share|improve this question




















  • 1





    All of those methods should have worked (well, the .bashrc one is only on opening a Terminal; .profile would have been better). What are you doing inside the .sh file? Is the executable bit set? Does it start with #!/bin/bash?

    – saiarcot895
    Jul 3 '14 at 16:41












  • As @saiarcot895 you may forgot to give executable permissions to file.

    – Sudheer
    Jul 3 '14 at 16:43











  • You would be able to find out what filetype it is set to by typing in ls -la

    – ryekayo
    Jul 3 '14 at 16:49











  • Please edit your post and include the script in question. Also, please clarify if you want this to run for a single user or for all users.

    – terdon
    Jul 3 '14 at 16:53













1













1









1








so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications. This didn't work. I tried editing the .desktop file for the startup application to set Terminal=true. This made it open temporarily but shut it down.
I tried editing .bashrc by adding the command bash /path/to/my/file.sh and it had the same effect. This seems like it should be really simple to do, even in linux, but I have tried lots of ways and had no success. I am on Ubuntu 14.something.










share|improve this question














so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications. This didn't work. I tried editing the .desktop file for the startup application to set Terminal=true. This made it open temporarily but shut it down.
I tried editing .bashrc by adding the command bash /path/to/my/file.sh and it had the same effect. This seems like it should be really simple to do, even in linux, but I have tried lots of ways and had no success. I am on Ubuntu 14.something.







login startup .desktop .sh






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 3 '14 at 16:38









user2662920user2662920

111 silver badge2 bronze badges




111 silver badge2 bronze badges










  • 1





    All of those methods should have worked (well, the .bashrc one is only on opening a Terminal; .profile would have been better). What are you doing inside the .sh file? Is the executable bit set? Does it start with #!/bin/bash?

    – saiarcot895
    Jul 3 '14 at 16:41












  • As @saiarcot895 you may forgot to give executable permissions to file.

    – Sudheer
    Jul 3 '14 at 16:43











  • You would be able to find out what filetype it is set to by typing in ls -la

    – ryekayo
    Jul 3 '14 at 16:49











  • Please edit your post and include the script in question. Also, please clarify if you want this to run for a single user or for all users.

    – terdon
    Jul 3 '14 at 16:53












  • 1





    All of those methods should have worked (well, the .bashrc one is only on opening a Terminal; .profile would have been better). What are you doing inside the .sh file? Is the executable bit set? Does it start with #!/bin/bash?

    – saiarcot895
    Jul 3 '14 at 16:41












  • As @saiarcot895 you may forgot to give executable permissions to file.

    – Sudheer
    Jul 3 '14 at 16:43











  • You would be able to find out what filetype it is set to by typing in ls -la

    – ryekayo
    Jul 3 '14 at 16:49











  • Please edit your post and include the script in question. Also, please clarify if you want this to run for a single user or for all users.

    – terdon
    Jul 3 '14 at 16:53







1




1





All of those methods should have worked (well, the .bashrc one is only on opening a Terminal; .profile would have been better). What are you doing inside the .sh file? Is the executable bit set? Does it start with #!/bin/bash?

– saiarcot895
Jul 3 '14 at 16:41






All of those methods should have worked (well, the .bashrc one is only on opening a Terminal; .profile would have been better). What are you doing inside the .sh file? Is the executable bit set? Does it start with #!/bin/bash?

– saiarcot895
Jul 3 '14 at 16:41














As @saiarcot895 you may forgot to give executable permissions to file.

– Sudheer
Jul 3 '14 at 16:43





As @saiarcot895 you may forgot to give executable permissions to file.

– Sudheer
Jul 3 '14 at 16:43













You would be able to find out what filetype it is set to by typing in ls -la

– ryekayo
Jul 3 '14 at 16:49





You would be able to find out what filetype it is set to by typing in ls -la

– ryekayo
Jul 3 '14 at 16:49













Please edit your post and include the script in question. Also, please clarify if you want this to run for a single user or for all users.

– terdon
Jul 3 '14 at 16:53





Please edit your post and include the script in question. Also, please clarify if you want this to run for a single user or for all users.

– terdon
Jul 3 '14 at 16:53










2 Answers
2






active

oldest

votes


















0



















When you set Terminal=true in the desktop file, the terminal window by default closes after the "the job has finished". An easy solution is to change your (terminal-) profile settings:



  • open a terminal window, choose Profile Preferences

  • choose "Title & Command" (at least that is what it is in Dutch, the second tab)

  • in the section "when the command has finished" choose "keep terminal window open"

And of course, like you did, in the desktop file, set Terminal=true



enter image description here






share|improve this answer
































    -1



















    Solution for Question --> "so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications."



    Suppose path of your file is /home/foster/Desktop/script.sh



    First make it executable by :



    $ chmod +x /home/foster/Desktop/script.sh


    Now just Add path of the script to file "/etc/rc.local" :



    sh /home/foster/Desktop/script.sh
    exit 0





    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',
      autoActivateHeartbeat: false,
      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/4.0/"u003ecc by-sa 4.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%2f491313%2fhow-to-run-a-sh-file-in-terminal-on-login%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown


























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0



















      When you set Terminal=true in the desktop file, the terminal window by default closes after the "the job has finished". An easy solution is to change your (terminal-) profile settings:



      • open a terminal window, choose Profile Preferences

      • choose "Title & Command" (at least that is what it is in Dutch, the second tab)

      • in the section "when the command has finished" choose "keep terminal window open"

      And of course, like you did, in the desktop file, set Terminal=true



      enter image description here






      share|improve this answer





























        0



















        When you set Terminal=true in the desktop file, the terminal window by default closes after the "the job has finished". An easy solution is to change your (terminal-) profile settings:



        • open a terminal window, choose Profile Preferences

        • choose "Title & Command" (at least that is what it is in Dutch, the second tab)

        • in the section "when the command has finished" choose "keep terminal window open"

        And of course, like you did, in the desktop file, set Terminal=true



        enter image description here






        share|improve this answer



























          0















          0











          0









          When you set Terminal=true in the desktop file, the terminal window by default closes after the "the job has finished". An easy solution is to change your (terminal-) profile settings:



          • open a terminal window, choose Profile Preferences

          • choose "Title & Command" (at least that is what it is in Dutch, the second tab)

          • in the section "when the command has finished" choose "keep terminal window open"

          And of course, like you did, in the desktop file, set Terminal=true



          enter image description here






          share|improve this answer














          When you set Terminal=true in the desktop file, the terminal window by default closes after the "the job has finished". An easy solution is to change your (terminal-) profile settings:



          • open a terminal window, choose Profile Preferences

          • choose "Title & Command" (at least that is what it is in Dutch, the second tab)

          • in the section "when the command has finished" choose "keep terminal window open"

          And of course, like you did, in the desktop file, set Terminal=true



          enter image description here







          share|improve this answer













          share|improve this answer




          share|improve this answer










          answered Jul 3 '14 at 17:12









          Jacob VlijmJacob Vlijm

          70.5k10 gold badges152 silver badges254 bronze badges




          70.5k10 gold badges152 silver badges254 bronze badges


























              -1



















              Solution for Question --> "so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications."



              Suppose path of your file is /home/foster/Desktop/script.sh



              First make it executable by :



              $ chmod +x /home/foster/Desktop/script.sh


              Now just Add path of the script to file "/etc/rc.local" :



              sh /home/foster/Desktop/script.sh
              exit 0





              share|improve this answer































                -1



















                Solution for Question --> "so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications."



                Suppose path of your file is /home/foster/Desktop/script.sh



                First make it executable by :



                $ chmod +x /home/foster/Desktop/script.sh


                Now just Add path of the script to file "/etc/rc.local" :



                sh /home/foster/Desktop/script.sh
                exit 0





                share|improve this answer





























                  -1















                  -1











                  -1









                  Solution for Question --> "so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications."



                  Suppose path of your file is /home/foster/Desktop/script.sh



                  First make it executable by :



                  $ chmod +x /home/foster/Desktop/script.sh


                  Now just Add path of the script to file "/etc/rc.local" :



                  sh /home/foster/Desktop/script.sh
                  exit 0





                  share|improve this answer
















                  Solution for Question --> "so I have a simple sh file I want to run whenever someone logs in. I tried adding it to startup applications."



                  Suppose path of your file is /home/foster/Desktop/script.sh



                  First make it executable by :



                  $ chmod +x /home/foster/Desktop/script.sh


                  Now just Add path of the script to file "/etc/rc.local" :



                  sh /home/foster/Desktop/script.sh
                  exit 0






                  share|improve this answer















                  share|improve this answer




                  share|improve this answer








                  edited Nov 8 '16 at 12:16

























                  answered Jul 3 '14 at 17:00









                  vivekyad4vvivekyad4v

                  3541 gold badge4 silver badges12 bronze badges




                  3541 gold badge4 silver badges12 bronze badges































                      draft saved

                      draft discarded















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f491313%2fhow-to-run-a-sh-file-in-terminal-on-login%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

                      Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

                      How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

                      Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü