Themabewertung:
  • 1 Bewertung(en) - 5 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Problem mit einrichten eines screen Befehls
#1
Ich zitiere mich mal aus einem anderen Thread von mir, wo bisher keine Reaktion erfolgte:
(14.06.2025, 11:26)Dorena Verne schrieb: Aber ein anderes Problemchen habe ich. Ich starte ja beide Instanzen mit screen, aber nur das erste funzt:

Script1:
opensim.sh
Code:
#!/bin/sh
while :
do
cd /home/bin
running=`ps ax|grep OpenSim.dll|grep -v grep`
if [ -z "$running" ]; then
      # The Log Entry
      TIME="OpenSim Down, Restarting: `date +"%A, %B %d - %r"`"
      echo $TIME >>/home/bin/os.log
      cd /home/bin
      screen -fa -S OS -d -U -m dotnet OpenSim.dll -gui=true -noverbose=true
      fi
      sleep 120
done

Script2
opensim1.sh
Code:
#!/bin/sh
while :
do
cd /home/sim2/bin
running=`ps ax|grep OpenSim.dll|grep -v grep`
if [ -z "$running" ]; then
      # The Log Entry
      TIME="OpenSim Down, Restarting: `date +"%A, %B %d - %r"`"
      echo $TIME >>/home/sim2/bin/os.log
      cd /home/sim2/bin
      screen -fa -S OS1 -d -U -m dotnet OpenSim.dll -gui=true -noverbose=true
      fi
      sleep 120
done

Hat jemand eine Idee woran das liegen könnte?
Zitieren
#2
Hallo Dorena,

Screen benutze ich zwar nicht, aber vermutlich liegt das Problem in der Schleifenlogik.
1) Beide Scripte starten, eins wird etwas schneller ausgeführt.
2) Das spätere Script sieht, dass OpenSim schon läuft, und führt den Inhalt der Schleife nicht mehr aus.

Du müsstest vermutlich ein anderes, eventuell zusätzliches Kriterium für "running" finden, um die beiden OpenSim Instanzen auseinander zu halten.

Viele Grüße,
Mareta
[-] The following 1 user says Thank You to Mareta Dagostino for this post:
  • DJ Archie
Zitieren
#3
Mehr las das bei jeder die korrekte Pfadeingabe steht kann es doch nicht sein, aber ich warte ob Manni oder Leute die sich mit screen auskennen sich melden, ins blaue vermuten, hält mich nur auf, sorry.
Zitieren
#4
Du fragst im Befehl "ps ax" aber nur ab, ob in den Prozessen der String "OpenSim.dll" mindestens einmal vorkommt. Da ist nichts von Pfad. Wenn in der Ausgabe von "ps ax" irgendein Unterschied zwischen den beiden Instanzen erkennbar ist, wäre das ein Ansatzpunkt.

Code:
running=`ps ax|grep OpenSim.dll|grep -v grep`

Aber wenn du Stress hast, kannst du natürlich auch warten, ob andere schon ein fertiges Script haben.
Zitieren
#5
Problem nun ist, dass ich nicht verstehe, was du genau meinst, das erste Script startet ja perfekt, was meinst du mit wie und wo abfrage. Hast du beide voll gescrollt? Sind ja in der Ansicht erstmal nicht vollständig zu sehen.
Zitieren
#6
"ps ax" gibt die aktiven Prozesse aus. Im Idealfall, wenn beide Regionen laufen, kommt der String "OpenSim.dll" dort zweimal vor.
Leider kommt der String dort immer noch vor, wenn eine Instanz von OpenSim nicht läuft. Das hat erst mal noch gar nichts mit dem Inhalt in den Schleifen zu tun. Wenn mindestens eine Instanz von OpenSim läuft, dann ist im zweiten Script die Bedingung " -z "$running" " nicht mehr erfüllt, weil ja die andere Instanz vom anderen Script schon gefunden wird.

Was jetzt nötig ist, ist ein Kriterium, das erkennt, ob die richtige Instanz von OpenSim schon/noch läuft, nicht ob irgendeine Instanz von OpenSim läuft. Am besten startest du beide Regionen manuell, rufst "ps ax" manuell auf, und versuchst in der Ausgabe irgendwas zu erkennen, woran du die passende Instanz erkennen kannst. Falls ja, kannst du relativ einfach das `ps ax|grep OpenSim.dll|grep -v grep` anpassen mit einer neuen Logik.
Zitieren
#7
Dafür bin ich zu blöd, deswegen postete ich das ja hier, in erster Linie wegen einer fertigen Lösung.
Zitieren
#8
Eine zugegebenermaßen "brute force" Methode fällt mir noch ein, die ist auch schnell getestet.

Benenne die eine Datei OpenSim1.dll, die andere Datei OpenSim2.dll. Dann teste im einen Script auf "OpenSim1.dll" und im anderen Script auf "OpenSim2.dll". Die Aufrufe zum Programmstart müsstest du natürlich auch anpassen.

EDIT: Das Umbenennen der dll's meine ich im "bin" Ordner der jeweiligen OpenSim Instanz.
Zitieren
#9
Code:
root@debian:~# ps ax
    PID TTY      STAT   TIME COMMAND
      1 ?        Ss     0:33 /sbin/init
      2 ?        S      0:00 [kthreadd]
      3 ?        I<     0:00 [rcu_gp]
      4 ?        I<     0:00 [rcu_par_gp]
      5 ?        I<     0:00 [slub_flushwq]
      6 ?        I<     0:00 [netns]
      8 ?        I<     0:00 [kworker/0:0H-events_highpri]
     10 ?        I<     0:00 [mm_percpu_wq]
     11 ?        I      0:00 [rcu_tasks_kthread]
     12 ?        I      0:00 [rcu_tasks_rude_kthread]
     13 ?        I      0:00 [rcu_tasks_trace_kthread]
     14 ?        S      0:13 [ksoftirqd/0]
     15 ?        I      6:41 [rcu_preempt]
     16 ?        S      0:03 [migration/0]
     18 ?        S      0:00 [cpuhp/0]
     19 ?        S      0:00 [cpuhp/1]
     20 ?        S      0:03 [migration/1]
     21 ?        S      0:07 [ksoftirqd/1]
     23 ?        I<     0:00 [kworker/1:0H-events_highpri]
     24 ?        S      0:00 [cpuhp/2]
     25 ?        S      0:03 [migration/2]
     26 ?        S      0:05 [ksoftirqd/2]
     28 ?        I<     0:00 [kworker/2:0H-events_highpri]
     29 ?        S      0:00 [cpuhp/3]
     30 ?        S      0:03 [migration/3]
     31 ?        S      0:06 [ksoftirqd/3]
     33 ?        I<     0:00 [kworker/3:0H-events_highpri]
     34 ?        S      0:00 [cpuhp/4]
     35 ?        S      0:03 [migration/4]
     36 ?        S      0:03 [ksoftirqd/4]
     38 ?        I<     0:00 [kworker/4:0H-events_highpri]
     39 ?        S      0:00 [cpuhp/5]
     40 ?        S      0:03 [migration/5]
     41 ?        S      0:04 [ksoftirqd/5]
     43 ?        I<     0:00 [kworker/5:0H-events_highpri]
     44 ?        S      0:00 [cpuhp/6]
     45 ?        S      0:03 [migration/6]
     46 ?        S      0:04 [ksoftirqd/6]
     48 ?        I<     0:00 [kworker/6:0H-events_highpri]
     49 ?        S      0:00 [cpuhp/7]
     50 ?        S      0:03 [migration/7]
     51 ?        S      0:06 [ksoftirqd/7]
     53 ?        I<     0:00 [kworker/7:0H-events_highpri]
     62 ?        S      0:00 [kdevtmpfs]
     63 ?        I<     0:00 [inet_frag_wq]
     64 ?        S      0:00 [kauditd]
     65 ?        S      0:00 [khungtaskd]
     66 ?        S      0:00 [oom_reaper]
     67 ?        I<     0:00 [writeback]
     68 ?        S      0:34 [kcompactd0]
     69 ?        SN     0:00 [ksmd]
     70 ?        SN     0:33 [khugepaged]
     71 ?        I<     0:00 [kintegrityd]
     72 ?        I<     0:00 [kblockd]
     73 ?        I<     0:00 [blkcg_punt_bio]
     74 ?        I<     0:00 [tpm_dev_wq]
     75 ?        I<     0:00 [edac-poller]
     76 ?        I<     0:00 [devfreq_wq]
     78 ?        I<     0:19 [kworker/0:1H-kblockd]
     79 ?        S      1:42 [kswapd0]
     87 ?        I<     0:00 [kthrotld]
     93 ?        I<     0:00 [acpi_thermal_pm]
     94 ?        S      0:12 [hwrng]
     95 ?        I<     0:00 [mld]
     96 ?        I<     0:19 [kworker/1:1H-kblockd]
     97 ?        I<     0:00 [ipv6_addrconf]
    102 ?        I<     0:00 [kstrp]
    108 ?        I<     0:00 [zswap-shrink]
    109 ?        I<     0:06 [kworker/u17:0-rb_allocator]
    153 ?        I<     0:19 [kworker/2:1H-kblockd]
    163 ?        I<     0:19 [kworker/6:1H-kblockd]
    164 ?        I<     0:20 [kworker/3:1H-kblockd]
    165 ?        I<     0:18 [kworker/5:1H-kblockd]
    166 ?        I<     0:19 [kworker/7:1H-kblockd]
    167 ?        I<     0:17 [kworker/4:1H-kblockd]
    201 ?        S      0:00 [irq/128-ALP0012:00]
    202 ?        I<     0:00 [ata_sff]
    206 ?        I<     0:00 [nvme-wq]
    207 ?        I<     0:00 [nvme-reset-wq]
    208 ?        I<     0:00 [nvme-delete-wq]
    210 ?        S      0:00 [scsi_eh_0]
    211 ?        I<     0:00 [scsi_tmf_0]
    212 ?        S      0:00 [scsi_eh_1]
    213 ?        I<     0:00 [scsi_tmf_1]
    214 ?        S      0:00 [scsi_eh_2]
    215 ?        I<     0:00 [scsi_tmf_2]
    216 ?        S      0:00 [scsi_eh_3]
    217 ?        I<     0:00 [scsi_tmf_3]
    219 ?        I<     0:00 [nvkm-disp]
    221 ?        S      0:00 [card1-crtc0]
    222 ?        S      0:00 [card1-crtc1]
    223 ?        S      0:00 [card1-crtc2]
    225 ?        S      0:00 [card0-crtc0]
    226 ?        S      0:00 [card0-crtc1]
    227 ?        S      0:00 [card0-crtc2]
    228 ?        S      0:00 [card0-crtc3]
    265 ?        S      0:00 [jbd2/nvme0n1p2-8]
    266 ?        I<     0:00 [ext4-rsv-conver]
    322 ?        Ss     1:47 /lib/systemd/systemd-journald
    340 ?        Ss     0:01 /lib/systemd/systemd-udevd
    390 ?        S      0:00 [irq/151-mei_me]
    402 ?        S      0:00 [watchdogd]
    491 ?        I<     0:00 [cryptd]
    496 ?        I<     0:00 [cfg80211]
    540 ?        S      8:35 [irq/153-iwlwifi]
    612 ?        I<     0:06 [kworker/u17:1-rb_allocator]
    628 ?        S      0:00 [jbd2/nvme0n1p5-8]
    629 ?        I<     0:00 [ext4-rsv-conver]
    630 ?        S      0:03 [jbd2/nvme0n1p6-8]
    631 ?        S      0:18 [jbd2/nvme0n1p3-8]
    632 ?        I<     0:00 [ext4-rsv-conver]
    633 ?        I<     0:00 [ext4-rsv-conver]
    671 ?        Ssl    0:03 /lib/systemd/systemd-timesyncd
    684 ?        Ss     0:36 avahi-daemon: running [debian.local]
    685 ?        Ss     0:00 /usr/libexec/bluetooth/bluetoothd
    687 ?        Ss     0:16 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
    700 ?        Ssl    0:00 /usr/lib/polkit-1/polkitd --no-debug
    702 ?        Ssl    0:20 /usr/sbin/rsyslogd -n -iNONE
    704 ?        Ssl    0:24 /usr/sbin/nscd
    706 ?        Ss     0:02 /lib/systemd/systemd-logind
    707 ?        Ssl    0:00 /usr/libexec/udisks2/udisksd
    721 ?        Ss     1:18 ha_logd: read process
    724 ?        S      0:00 avahi-daemon: chroot helper
    731 ?        S      1:16 ha_logd: write process
    735 ?        Ssl    1:29 /usr/sbin/NetworkManager --no-daemon
    736 ?        Ss     0:07 /sbin/wpa_supplicant -u -s -O DIR=/run/wpa_supplicant GROUP=netdev
    753 ?        Ssl    0:00 /usr/sbin/ModemManager
    810 ?        Ssl    0:00 /usr/sbin/lightdm
    827 ?        Ss     0:44 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
    841 tty7     Ssl+   1:49 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
    842 tty1     Ss+    0:00 /sbin/agetty -o -p -- \u --noclear - linux
    902 ?        Ssl  115:39 /usr/sbin/mariadbd
    998 ?        Sl     0:00 lightdm --session-child 19 22
   1002 ?        Ss     0:00 /lib/systemd/systemd --user
   1003 ?        S      0:00 (sd-pam)
   1018 ?        S<sl   0:00 /usr/bin/pulseaudio --daemonize=no --log-target=journal
   1019 ?        Ssl    5:32 /usr/sbin/lightdm-gtk-greeter
   1020 ?        SNsl   0:08 /usr/libexec/rtkit-daemon
   1034 ?        Ss     0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
   1035 ?        Ssl    0:00 /usr/libexec/at-spi-bus-launcher
   1041 ?        S      0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 11 --address=unix:path=/run/user/107/at-spi/bus
   1043 ?        Ssl    0:00 /usr/libexec/gvfsd
   1075 ?        S      0:00 lightdm --session-child 15 22
   1077 ?        Sl     0:00 /usr/libexec/at-spi2-registryd --use-gnome-session
   1136 ?        SLsl  72:38 /usr/sbin/corosync -f
   1200 ?        Ssl    0:04 /usr/sbin/slapd -h ldap:/// ldapi:/// -g openldap -u openldap -F /etc/ldap/slapd.d
   1219 ?        Ss     0:32 /usr/sbin/nmbd --foreground --no-process-group
   1232 ?        Sl     0:06 /usr/sbin/nslcd
   1239 ?        Ss     0:01 /usr/sbin/cron -f
   1313 ?        Ss     0:43 /usr/sbin/apache2 -k start
   1317 ?        Ss     0:04 /usr/sbin/smbd --foreground --no-process-group
   1340 ?        S      0:01 /usr/sbin/smbd --foreground --no-process-group
   1341 ?        S      0:01 /usr/sbin/smbd --foreground --no-process-group
   1361 ?        Ss    10:06 /usr/sbin/pacemakerd
   1375 ?        Ss     6:25 /usr/lib/pacemaker/pacemaker-based
   1376 ?        Ss     6:22 /usr/lib/pacemaker/pacemaker-fenced
   1377 ?        Ss     6:26 /usr/lib/pacemaker/pacemaker-execd
   1378 ?        Ss     6:18 /usr/lib/pacemaker/pacemaker-attrd
   1379 ?        Ss     6:12 /usr/lib/pacemaker/pacemaker-schedulerd
   1380 ?        Ss     7:02 /usr/lib/pacemaker/pacemaker-controld
   1583 ?        Ss     0:05 /usr/lib/postfix/sbin/master -w
   1585 ?        S      0:01 qmgr -l -t unix -u
   1588 ?        Ss     1:37 /usr/bin/perl /usr/share/usermin/miniserv.pl /etc/usermin/miniserv.conf
   1589 ?        Ss     2:07 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
   1622 ?        I<     0:00 [tls-strp]
   1726 ?        Ss     0:00 /lib/systemd/systemd --user
   1727 ?        S      0:00 (sd-pam)
   1758 ?        S    124:22 /usr/bin/perl /usr/share/webmin/authentic-theme/stats.pl 557
   4705 ?        S      0:00 tlsmgr -l -t unix -u -c
  50415 ?        I<     0:00 [dio/nvme0n1p3]
2602335 ?        I      0:16 [kworker/3:0-events]
2810614 ?        Ss     0:00 SCREEN -fa -S OS -d -U -m dotnet OpenSim.dll -gui=true -noverbose=true
2810616 pts/1    Ssl+ 289:52 dotnet OpenSim.dll -gui=true -noverbose=true
2829390 ?        I      0:05 [kworker/0:3-events]
2847488 ?        Rl   1419:47 dotnet OpenSim.dll
3034427 ?        I      0:02 [kworker/4:0-mm_percpu_wq]
3035143 ?        Ss     0:00 /usr/sbin/cupsd -l
3035144 ?        Ssl    0:00 /usr/sbin/cups-browsed
3035155 ?        S      0:00 /usr/sbin/apache2 -k start
3035156 ?        S      0:01 /usr/sbin/apache2 -k start
3035157 ?        S      0:00 /usr/sbin/apache2 -k start
3035158 ?        S      0:00 /usr/sbin/apache2 -k start
3035159 ?        S      0:00 /usr/sbin/apache2 -k start
3035166 ?        Ss     0:00 proftpd: (accepting connections)
3038095 ?        S      0:00 /usr/sbin/apache2 -k start
3047904 ?        I      0:03 [kworker/5:1-mm_percpu_wq]
3048137 ?        I      0:02 [kworker/6:0-mm_percpu_wq]
3089839 ?        S      0:00 /usr/sbin/apache2 -k start
3190340 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3198827 ?        I      0:01 [kworker/u16:0-flush-259:5]
3200893 ?        I      0:00 [kworker/1:0-events]
3202641 ?        I      0:00 [kworker/2:1-events]
3209973 ?        I      0:00 [kworker/7:2-events]
3213933 ?        S      0:00 pickup -l -t unix -u -c
3214077 ?        I      0:00 [kworker/5:2-events]
3217140 ?        I      0:00 [kworker/u16:4-ext4-rsv-conversion]
3219689 ?        I      0:00 [kworker/1:1]
3220173 ?        I      0:00 [kworker/6:1-mm_percpu_wq]
3220602 ?        I      0:00 [kworker/3:2-events]
3220886 ?        I      0:00 [kworker/4:1]
3221274 ?        I      0:00 [kworker/0:1-events]
3221824 ?        I      0:00 [kworker/u16:2-flush-259:5]
3221867 ?        I      0:00 [kworker/2:0-events]
3222263 ?        I      0:00 [kworker/7:0-events]
3222709 ?        I      0:00 [kworker/6:2-events]
3223342 ?        I      0:00 [kworker/u16:1-events_unbound]
3223740 ?        I      0:00 [kworker/7:1]
3223815 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223816 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223817 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223818 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223819 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223820 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223821 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223822 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223837 pts/2    Ss     0:00 -bash
3223838 ?        S      0:00 /usr/bin/perl /usr/share/webmin/xterm/shellserver.pl 555 root
3223841 ?        S      0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf
3223927 ?        I      0:00 [kworker/2:2]
3223973 ?        S      0:00 sh -c (vmstat 1 2 2>/dev/null)
3223974 ?        S      0:00 vmstat 1 2
3223975 pts/2    R+     0:00 ps ax
root@debian:~#

Das ist die Ausgabe, sorry ich arbeite fast ausschliesslich untwe Webmin und da steht es ja unter den schönen deutschen menü: "laufende Prozesse"^^Aber manuell, gehts ja auch,..ok...
Zitieren
#10
(15.06.2025, 12:59)Mareta Dagostino schrieb: Eine zugegebenermaßen "brute force" Methode fällt mir noch ein, die ist auch schnell getestet.

Benenne die eine Datei OpenSim1.dll, die andere Datei OpenSim2.dll. Dann teste im einen Script auf "OpenSim1.dll" und im anderen Script auf "OpenSim2.dll". Die Aufrufe zum Programmstart müsstest du natürlich auch anpassen.

EDIT: Das Umbenennen der dll's meine ich im "bin" Ordner der jeweiligen OpenSim Instanz.
DAS klingt interessant, werd eich nachher mal testen, bin gerade auf einer gänzlich anderen Baustelle :-)
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  OpenSim Problem mit Raspberry Pi 4 Pius Noel 1 1.055 12.08.2024, 19:25
Letzter Beitrag: Pius Noel
  Problem nach Kernel-Update Klarabella Karamell 29 9.522 26.05.2022, 22:34
Letzter Beitrag: Bogus Curry
  Problem mit Mint Klarabella Karamell 16 6.466 12.11.2021, 22:49
Letzter Beitrag: Dorena Verne
  Cinnamon 19.2: Problem mit Standaloneserver und Mysql argus Portal 4 6.230 27.08.2019, 09:28
Letzter Beitrag: Pius Noel
  Alpha-Blending Problem unter Linux Dorena Verne 17 20.806 23.08.2019, 10:40
Letzter Beitrag: Dorena Verne

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste