• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    langage de programmation

    Scheduled Pinned Locked Moved
    General
    3
    51
    9.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • george1421G
      george1421 Moderator @julio
      last edited by

      @julio said in langage de programmation:

      en passant george je travail sur des VM sur virtualbox et lors de la création de mon pc ubuntu desktop, j’ai partitionner mon dique dur virtuel. es ce cela le problème.

      No works the same. I was just warning if you use real hardware that it could change the way your script runs because hardware changes.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      J 1 Reply Last reply Reply Quote 0
      • J
        julio @george1421
        last edited by

        @george1421 juste pour me rassurer, je ne vais pas par hasard modifier mon fichier host…

        george1421G 1 Reply Last reply Reply Quote 0
        • george1421G
          george1421 Moderator @julio
          last edited by

          @julio I will give you a hint to maybe help you with your scripting.

          FOG has a special mode you can use to debug your programs right on the target computer. So do the following.

          1. Register your VM with fog (if you have not done so already)
          2. Schedule a new deployment task, but before you press the Schedule Task button, enable the Debug checkbox, then schedule the task.
          3. PXE boot the target computer.
          4. After several screens of text, you can clear by pressing the ENTER key. You will land on the FOS LINUX command prompt.

          Now run lsblk to find your hard drive. See if you can find from lsblk your root partition.

          Now manually run

          mkdir -p /ntfs
          mount /dev/sdaX /ntfs
          

          Just as a test run the echo command the variable ${hostname} will not be set yet so you can’t use it here. But you can find out the right location and partition to use. You will not see all of the loop devices that ubuntu creates so it will be clear what partitions you want.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

          J 3 Replies Last reply Reply Quote 0
          • george1421G
            george1421 Moderator @julio
            last edited by

            @julio said in langage de programmation:

            juste pour me rassurer, je ne vais pas par hasard modifier mon fichier host…

            This is why I suggested to test your program using FOS Linux in debug mode. No chance to break your FOG server.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

            1 Reply Last reply Reply Quote 0
            • J
              julio @george1421
              last edited by

              @george1421 j’essaye ça et je te tiens au courant merci beaucoup.

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by

                @julio When you added the echo "OK, osid is 50/Linux" into your script, did you see that message on the console??

                You might want to add the mentioned read command as well so it waits for your input…

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                J 1 Reply Last reply Reply Quote 0
                • J
                  julio @Sebastian Roth
                  last edited by

                  @sebastian-roth salut roth. non je ne vois rien sur la console de mon serveur fog apparement le script ne fonctionne pas. je veux bien savoir.
                  comment verifier que le script est bien fonctionnel???
                  j’ai bien donner les droits d’execution à savoir chmod +x renamehost.sh

                  1 Reply Last reply Reply Quote 0
                  • J
                    julio @george1421
                    last edited by

                    @george1421 salut george. oui j’ai fais ce que tu m’as démander mais je n’arrive pas sur l’invite de commande de fos linux. y’a t’il pas une autre manière???

                    george1421G 2 Replies Last reply Reply Quote 0
                    • george1421G
                      george1421 Moderator @julio
                      last edited by

                      @julio OK give me 5 minutes and I will give you more hints.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                      1 Reply Last reply Reply Quote 0
                      • george1421G
                        george1421 Moderator @julio
                        last edited by george1421

                        @julio To get into debug mode on the pxe booting computer make sure you enabled debug mode.

                        Screenshot from 2021-02-02 17-42-30.png

                        See the Schedule as debug task option? When you do this and pxe boot the target computer you will end at the FOS Linux command prompt.

                        In your script for debugging purposes you should add

                        echo "Some step in the script"
                        debugPause;
                        

                        This way you will know when and where your script is in the program. I add these quite often at specific points in my scripts.

                        Also make sure you add your script like fog.custominstall or renamehost.sh to the master script of fog.postdownload or your script will not be called by fog.

                        IF you are ready to debug your script AND you are at the FOS Linux command prompt key in fog to start the deployment. The FOG deployment will stop at all of the debugPause commands during deployment. Press enter to go to the next step. When / IF you get to see OK, osid is 50/Linux on the screen and you see a bug you can press CTRL-C to exit the script. The FOG Postinstall scripts are run right after the last partclone copy screen. You can fix what you need then restart the deployment process again by typing fog in again. You can do this testing as many times as you want without needing to reboot the pxe target computer.

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                        J 1 Reply Last reply Reply Quote 0
                        • J
                          julio @george1421
                          last edited by

                          @george1421
                          j’ai reussi à entrer dans la partition de debogage. j’ai executer la commande lsblk. voici ce que j’obtient.partitionparclone.PNG

                          george1421G 1 Reply Last reply Reply Quote 0
                          • J
                            julio @george1421
                            last edited by

                            @george1421 salut george. j’ai eu une erreur qui s’affiche on me precise syntax error. donc le script essaye de s’executer mais petite erreur. voici l’image en questionerreur.PNG

                            1 Reply Last reply Reply Quote 0
                            • J
                              julio @Sebastian Roth
                              last edited by

                              @sebastian-roth oui roth j’ai vu ou il y’a erreur: c’est au niveau de la ligne5 dans mon code: ici

                              if [[“$osid”==“50”]]; then ça me dire sysntax error. juste pour vous donner un indice.

                              1 Reply Last reply Reply Quote 0
                              • george1421G
                                george1421 Moderator @julio
                                last edited by

                                @julio said in langage de programmation:

                                ’ai reussi à entrer dans la partition de debogage. j’ai executer la commande lsblk. voici ce que j’obtient

                                Ok I see only one partition then /dev/sda1. Now you know what your target partition is.

                                donc le script essaye de s’executer mais petite erreur.

                                Here is an example of my if/then

                                        if [[ -z $hd ]]; then
                                            handleError "Could not find hdd to use"
                                        fi
                                

                                When you look at your if / then statement do you see any differences? How about spacing?

                                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                J 1 Reply Last reply Reply Quote 0
                                • J
                                  julio @george1421
                                  last edited by

                                  @george1421 voici mon script finalmon scriptfinal.PNG

                                  george1421G 2 Replies Last reply Reply Quote 0
                                  • george1421G
                                    george1421 Moderator @julio
                                    last edited by

                                    @julio You MUST look at the if statement. It is wrong.

                                    if[[ $osid == 50 ]];then
                                    

                                    Should be rewritten as

                                    if [[ $osid == "50" ]]; then
                                    

                                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                    1 Reply Last reply Reply Quote 0
                                    • george1421G
                                      george1421 Moderator @julio
                                      last edited by

                                      @julio I also see you are missing fi

                                      if [[ $osid == "50" ]]; then
                                          echo "Hello Mom"
                                      fi
                                      

                                      Is the syntax

                                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                      J 1 Reply Last reply Reply Quote 0
                                      • J
                                        julio @george1421
                                        last edited by

                                        @george1421 désolé j’ai toujours la meme erreur. je sais pas si je doit changer totalement la ligne 5.script1.PNG en passant j’ai bien
                                        fi à la fin de mon script.

                                        george1421G 1 Reply Last reply Reply Quote 0
                                        • george1421G
                                          george1421 Moderator @julio
                                          last edited by george1421

                                          @julio Your program is still wrong. I will type short items because I am tired.

                                          #!/bin/bash
                                          echo "hello"
                                          read
                                          
                                          if [[ $osid == "50" ]]; then
                                            echo "ok"
                                          
                                            mdkir -p /ext
                                          
                                            mount /dev/sda1 /ext
                                          
                                            echo $hostname > /ext/etc/hostname
                                          
                                            unmount /ext
                                          fi
                                          
                                          1. Your if command needs a space after if and the first square bracket
                                          2. You need fi at the end to show the closing of the if statement.

                                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                          J 2 Replies Last reply Reply Quote 0
                                          • J
                                            julio @george1421
                                            last edited by

                                            @george1421 salut george. vraiment merci beaucoup pour tout ça fonctionne bien maintenant

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • First post
                                              Last post

                                            211

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project