• 🏠 Home
  • 🧰 Online Generators
  • 📰 Blog
  • 🔎 Search
  • 📧 Contact
  • 📘 Guestbook
  • 🗞️ News
  • 💰 Support
  • ℹ️ Info: The website has been modernized to improve readability and smartphone compatibility. Feel free to report any bugs using the contact form
     

    Sorry, but this page is not yet available in english.

    Clic here to send a translate request


    Programmation Perl - Fonction vérifiant si un Process est présent en mémoire


    Cette fonction va attendre vérifier si un process est en cours d'exécution.
    Elle renvoie 0 si le process n'est pas en train de s'exécuter. Si le process est présent en mémoire, elle renvoie 1.

    Le code

    sub checkPID {
        my $PID = $_[0];
        my $exists = kill 0, $PID;
        if ($exists==0) {
            printf("Process ID $PID is not running\n");
            return(0);
        } else {
            printf("Process ID $PID is running\n");
            return(1);
        }    
    }
    
    $Result=checkPID(6084);
    print "Result: $Result\n";
    

    Résultat

      
      Process ID 6084 is running
      Result: 1
      
      si le process 6084 est en train de s'éxecuter.

       

      Retour


    (c) 2005-2025 Jérôme DESMOULINS
    Data privacy