Visualizzazione dei risultati da 1 a 10 su 10
  1. #1

    come si avvia uno script python in background?

    ciao
    come si avvia uno script python in background?
    grazie

  2. #2

    Re: come si avvia uno script python in background?

    Originariamente inviato da matteolandi
    ciao
    come si avvia uno script python in background?
    grazie
    bè credo come per qualsiasi altro programma, mettendo una & dopo il nome del programma. Per esempio

    py programma.py &
    "L'utopia è come l'orizzonte: cammino due passi, e si allontana di due passi. Cammino di dieci passi, e si allontana di dieci passi. E allora, a cosa serve l'utopia? A questo: serve per continuare a camminare."
    Eduardo Galeano
    Il mio sito
    "if you want people to RTFM, make a better FM!"

  3. #3
    ok però se lo eseguo via ssh, attraverso una finestra di terminale, il processo genitore è bash e quando chiudo il terminale viene terminato anche il mio script

  4. #4
    Bella domanda interessa molto anche a me...
    l' unica soluzione che avevo trovato era inserire il comando in qualche init.
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  5. #5
    Originariamente inviato da claudiocrack
    Bella domanda interessa molto anche a me...
    l' unica soluzione che avevo trovato era inserire il comando in qualche init.
    no, c'era un modo molto più semplice, era un comando da anteporre al comando, ma mica me lo ricordo...
    "L'utopia è come l'orizzonte: cammino due passi, e si allontana di due passi. Cammino di dieci passi, e si allontana di dieci passi. E allora, a cosa serve l'utopia? A questo: serve per continuare a camminare."
    Eduardo Galeano
    Il mio sito
    "if you want people to RTFM, make a better FM!"

  6. #6
    Utente di HTML.it L'avatar di gigyz
    Registrato dal
    Oct 2003
    Messaggi
    1,443
    nohup "comando"

  7. #7
    Grandeeee sono anni che cerco questo comando pensavo non esistesse...


    Grazie
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  8. #8
    Utente di HTML.it L'avatar di gigyz
    Registrato dal
    Oct 2003
    Messaggi
    1,443
    ovviamente con nohup si perde il controllo del processo e lo si può solo killare, per lanciare invece comandi in background e poi poter riprenderne il controllo si usa screen, molto utile per esempio quando si lavora su server remoti.

  9. #9
    fw:/home/lalo# screen -h
    Use: screen [-opts] [cmd [args]]
    or: screen -r [host.tty]

    Options:
    -a Force all capabilities into each window's termcap.
    -A -[r|R] Adapt all windows to the new display width & height.
    -c file Read configuration file instead of '.screenrc'.
    -d (-r) Detach the elsewhere running screen (and reattach here).
    -dmS name Start as daemon: Screen session in detached mode.
    -D (-r) Detach and logout remote (and reattach here).
    -D -RR Do whatever is needed to get a screen session.
    -e xy Change command characters.
    -f Flow control on, -fn = off, -fa = auto.
    -h lines Set the size of the scrollback history buffer.
    -i Interrupt output sooner when flow control is on.
    -l Login mode on (update /var/run/utmp), -ln = off.
    -list or -ls. Do nothing, just list our SockDir.
    -L Turn on output logging.
    -m ignore $STY variable, do create a new screen session.
    -O Choose optimal output rather than exact vt100 emulation.
    -p window Preselect the named window if it exists.
    -q Quiet startup. Exits with non-zero return code if unsuccessful.
    -r Reattach to a detached screen process.
    -R Reattach if possible, otherwise start a new session.
    -s shell Shell to execute rather than $SHELL.
    -S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
    -t title Set title. (window's name).
    -T term Use term as $TERM for windows, rather than "screen".
    -U Tell screen to use UTF-8 encoding.
    -v Print "Screen version 4.00.03 (FAU) 23-Oct-06".
    -wipe Do nothing, just clean up SockDir.
    -x Attach to a not detached screen. (Multi display mode).
    -X Execute <cmd> as a screen command in the specified session.
    fw:/home/lalo#


    parli di questo screen qui??
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  10. #10

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.