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 yun1 +XWiki.wikibot - Content
-
... ... @@ -12,8 +12,9 @@ 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 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 - 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 +}}} 17 17 * 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. 18 18 19 19 {{html wiki="true"}} ... ... @@ -28,22 +28,20 @@ 28 28 %CODE{ lang=\"bash\" }% #!/bin/bash while true do sleep 1 date done >> datum.txt 29 29 30 30 %ENDCODE% 31 - 32 32 ---- 33 33 34 -{{id name="NohupAnchor"/}} 35 - 34 +{{id name="NohupAnchor" /}} 36 36 == 3. nohup == 37 37 38 38 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 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. 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. 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]] 46 - 45 +[[image:https://xwiki.rbg.tum.de/bin/download/Informatik/Helpdesk/ProgrammeBeimLogoutNichtBeenden/WebHome/nohupTest.png|| alt=""]] 47 47 ---- 48 48 49 49 == 4. screen == ... ... @@ -52,35 +52,46 @@ 52 52 53 53 54 54 First here are some basic control commands: 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}}} 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 +}}} 59 59 * 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 60 60 * start one more virtual console: 61 61 ** ##Strg## + ##A## and then ##C## 62 -* close a virtual console: 64 +* close a virtual console: 63 63 ** ##Strg## + ##A## and then ##K## 64 -* switch between the virtual consoles: 66 +* switch between the virtual consoles: 65 65 ** ##Strg## + ##A## and then ##Leertaste## 66 66 ** ##Strg## + ##A## and then number between 0 and 9 (for the corresponding console) 67 -* detach the current session: 69 +* detach the current session: 68 68 ** ##Strg## + ##A## and then ##D## 69 -** for a certain session (in this case sitzung1) {{{screen -d sitzung1}}} 70 -* reestablish connection to a session (here sitzung1) 71 +** for a certain session (in this case sitzung1) {{{ 72 + screen -d sitzung1 73 +}}} 74 +* reestablish connection to a session (here sitzung1) 71 71 ** screen -r sitzung1 72 -* end session 76 +* end session 73 73 ** ##Strg## + ##D## 74 -** {{{exit}}} 78 +** {{{ 79 + exit 80 +}}} 75 75 ** close the last virtual console 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]] 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=""]] 78 78 * show all keyboard shortcuts 79 79 ** enter ##Strg## + ##A## and then ##?## 80 -* refer to the man pages for the full documentation of the screen command {{{man screen}}} 88 +* refer to the man pages for the full documentation of the screen command {{{ 89 + man screen 90 +}}} 81 81 82 - Steps for using the screen (see the commands above): 83 83 93 + Steps for using the screen (see the commands above): 84 84 * start programs 85 85 ** open terminal window 86 86 ** start screen – thereby automatically creating a session, that is attached ... ... @@ -88,7 +88,7 @@ 88 88 ** start new consoles and programs if needed 89 89 ** detach the current sessions 90 90 ** close terminal window 91 -* end programs 101 +* end programs 92 92 ** open terminal window 93 93 ** list all running screen sessions 94 94 ** resume desired screen sessions ... ... @@ -99,3 +99,5 @@ 99 99 {{html wiki="true"}} 100 100 <hr /> 101 101 {{/html}} 112 + 113 +