Changes for page Programme so ausführen, dass sie beim Logout nicht beendet werden
Last modified by Yunhao Wu on 2023/07/05 16:11
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.w ikibot1 +XWiki.wyun - Content
-
... ... @@ -12,9 +12,8 @@ 12 12 13 13 If a student wants to run a computer intensive program at night, this is in principle not a problem, as far as the following points are taken into consideration: 14 14 15 - in order to connect to lxhalle via SSH you have to enter in the terminal the passphrase, that is standing below your in.tum-Login (Informatik/RBG-Login). [[Here>>https://xwiki.rbg.tum.de/bin/view/Informatik/Helpdesk/Ssh_mit_PuTTY]] is !HowTo for Windows users, who should set up !PuTTY, which enables the ssh connection via terminal. {{{ 16 -ssh RBG-Kennung@lxhalle.in.tum.de 17 -}}} 15 + in order to connect to lxhalle via SSH you have to enter in the terminal the passphrase, that is standing below your cit.tum-Login (CIT/ITO-Login). [[Here>>https://xwiki.rbg.tum.de/bin/view/Informatik/Helpdesk/Ssh_mit_PuTTY]] is !HowTo for Windows users, who should set up !PuTTY, which enables the ssh connection via terminal. {{{ssh ITO-Kennung@lxhalle.in.tum.de}}} 16 + 18 18 * in order the programs to work without harming other computer users, they should be started with one of the lowest possible scheduling priorities. This happens with the command \“nice -n19\” as shown in the HowTo example. 19 19 20 20 {{html wiki="true"}} ... ... @@ -29,20 +29,22 @@ 29 29 %CODE{ lang=\"bash\" }% #!/bin/bash while true do sleep 1 date done >> datum.txt 30 30 31 31 %ENDCODE% 31 + 32 32 ---- 33 33 34 -{{id name="NohupAnchor" /}} 34 +{{id name="NohupAnchor"/}} 35 + 35 35 == 3. nohup == 36 36 37 37 In case a program is started with the nohup command, the HUP-signal, that is send by the logout is ignored. So the program proceeds further even after the user has already logged out 38 -* the following input {{{ 39 -nice -n 19 nohup ./test.sh & 40 -}}} starts the test script and the control operator (##&##) makes the command run in the background. 39 + 40 +* the following input {{{nice -n 19 nohup ./test.sh & }}}starts the test script and the control operator (##&##) makes the command run in the background. 41 41 * from now on the date is written in the file ##datum.txt##, even after the user logs out 42 42 * after running ##nohup## the PID of the process is shown. PID can be used to close a program (if it doesn’t terminate automatically), to do so you should enter the following command ##kill PID##. 43 43 * now you can continue your work in the terminal or you can close it without terminating the program 44 44 * by logging out and then once again in, you can check, whether in the file ##datum.txt## it’s still written 45 -[[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/ProgrammeBeimLogoutNichtBeenden/WebHome/nohupTest.png|| alt=""]] 45 +[[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/ProgrammeBeimLogoutNichtBeenden/WebHome/nohupTest.png]] 46 + 46 46 ---- 47 47 48 48 == 4. screen == ... ... @@ -51,46 +51,35 @@ 51 51 52 52 53 53 First here are some basic control commands: 54 -* start screen: 55 -** {{{ 56 - nice -n 19 screen 57 -}}} 58 -** command for starting a session with customized name (in our case named sitzung1) {{{ 59 - nice -n 19 screen -S sitzung1 60 -}}} 55 + 56 +* start screen: 57 +** {{{nice -n 19 screen}}} 58 +** command for starting a session with customized name (in our case named sitzung1) {{{nice -n 19 screen -S sitzung1}}} 61 61 * at the beginning some information for the program is shown and then you can click the space bar, the console will still remain unchanged – you have started the screen session and you are now in the first virtual console 62 62 * start one more virtual console: 63 63 ** ##Strg## + ##A## and then ##C## 64 -* close a virtual console: 62 +* close a virtual console: 65 65 ** ##Strg## + ##A## and then ##K## 66 -* switch between the virtual consoles: 64 +* switch between the virtual consoles: 67 67 ** ##Strg## + ##A## and then ##Leertaste## 68 68 ** ##Strg## + ##A## and then number between 0 and 9 (for the corresponding console) 69 -* detach the current session: 67 +* detach the current session: 70 70 ** ##Strg## + ##A## and then ##D## 71 -** for a certain session (in this case sitzung1) {{{ 72 - screen -d sitzung1 73 -}}} 74 -* reestablish connection to a session (here sitzung1) 69 +** for a certain session (in this case sitzung1) {{{screen -d sitzung1}}} 70 +* reestablish connection to a session (here sitzung1) 75 75 ** screen -r sitzung1 76 -* end session 72 +* end session 77 77 ** ##Strg## + ##D## 78 -** {{{ 79 - exit 80 -}}} 74 +** {{{exit}}} 81 81 ** close the last virtual console 82 -* list all running session with their names (example in picture be 6561) {{{ 83 - screen -ls 84 -}}} 85 -[[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/ProgrammeBeimLogoutNichtBeenden/WebHome/screen.jpg|| alt=""]] 76 +* list all running session with their names (example in picture be 6561) {{{screen -ls }}} 77 +[[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/ProgrammeBeimLogoutNichtBeenden/WebHome/screen.jpg]] 86 86 * show all keyboard shortcuts 87 87 ** enter ##Strg## + ##A## and then ##?## 88 -* refer to the man pages for the full documentation of the screen command {{{ 89 - man screen 90 -}}} 80 +* refer to the man pages for the full documentation of the screen command {{{man screen}}} 91 91 92 - 93 93 Steps for using the screen (see the commands above): 83 + 94 94 * start programs 95 95 ** open terminal window 96 96 ** start screen – thereby automatically creating a session, that is attached ... ... @@ -98,7 +98,7 @@ 98 98 ** start new consoles and programs if needed 99 99 ** detach the current sessions 100 100 ** close terminal window 101 -* end programs 91 +* end programs 102 102 ** open terminal window 103 103 ** list all running screen sessions 104 104 ** resume desired screen sessions ... ... @@ -109,5 +109,3 @@ 109 109 {{html wiki="true"}} 110 110 <hr /> 111 111 {{/html}} 112 - 113 -