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

    Provision with Script

    Scheduled Pinned Locked Moved Solved
    Feature Request
    4
    33
    5.4k
    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.
    • Z
      zfeng
      last edited by

      This helps a lot. This is an amazing project

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

        @zfeng So to add on to the information Tom provided, the FOG post init (before imaging) and post install (after imaging) scripts are executed by the FOS Linux engine (the customized linux OS that runs on the target computer for capturing and deploying images). So the post init and post install scripts need to be written in a bash shell script. That will be run within the context of the target computer. So if you can create an AWS EC2 instance from a linux command line then you might be able to do it in a FOG script. You also have to be aware that FOS Linux is a very small and fast OS, its not a full linux distribution so not all of the programs on a full linux distro are on FOS Linux. That’s not saying they can’t be, just they might not be today.

        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
        • Z
          zfeng
          last edited by

          Thanks so much for your info. Basically, the way I use the FOG is to provision physical computer. After the imaging process is complete, I would like to run some kind of script on the target system, such as making curl request to download something. I don’t know if that is possible with FOG @george1421

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

            @zfeng Yes FOG Linux has the curl command because it uses that and a few other commands to “talk” to the fog server during imaging.

            One could (in a post install script) mount the target hard drive and then use a properly crafted wget or curl call to download a file onto the target hard drive. Unmount the target hard drive then complete the FOG imaging process.

            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!

            Z 2 Replies Last reply Reply Quote 0
            • Z
              zfeng @george1421
              last edited by

              @george1421 I think I need to be more precise. Let’s say that the image is deployed properly. Is that a way I can run script just like you can run that on the terminal? For now, after I complete the imaging provision, I have to power up the computer and run customized script to download something and install certain package which is must be done after the imaging process.I am sorry if I did not make the point clear

              george1421G 1 Reply Last reply Reply Quote 0
              • Z
                zfeng @george1421
                last edited by

                @george1421 I basically want to eliminate the part that I need to run the script after the provision is done.

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

                  @zfeng You can download the “something” and write it to the target hard drive, but you can not “install it” because it would install within the context of FOS Linux which runs from RAM. When the computer is rebooted fos linux is gone.

                  BUT what you can do is download something to the target computer and then create a file in /etc/init.d on the target disk (you will probably need to create the sym link in proper init folder so that it will run in the proper startup mode). Lets say you created a file call S99local and in that batch file you placed the commands to run the thing that FOS Linux downloaded and stored on the target computer. Once the script ran it would delete the /etc/init.d/S99local script so it wouldn’t run each time the system booted. That way FOS LInux could download (or copy the something from the FOG server) and when the target computer booted the first time it would run the script to install it.

                  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!

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

                    @zfeng Of course that assumes you are installing linux on a target computer. If it was a windows OS on the target computer we still could do something similar you would just have to change how the script or PS was launched by updating the windows registry for run once with a FOS Linux post install script.

                    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!

                    JunkhackerJ 1 Reply Last reply Reply Quote 0
                    • JunkhackerJ
                      Junkhacker Developer @george1421
                      last edited by

                      or run the script with the fog client as a snapin

                      signature:
                      Junkhacker
                      We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                      Z 1 Reply Last reply Reply Quote 0
                      • Z
                        zfeng @george1421
                        last edited by

                        @george1421 Thing is getting more clear. However, I still need some help. The reason why I need run script every time after I provision the computer is because with different computer I need to download different stuff for the different computer. Let’s say that I have computerA and computerB that I need to provision. How can I possibly specify argument with script, such as, Computer=ComputerA ./script.sh on the home directory?

                        JunkhackerJ 1 Reply Last reply Reply Quote 0
                        • Z
                          zfeng @Junkhacker
                          last edited by

                          @Junkhacker can I run that on the home directory after the computer finishes provisioning? Thanks for jumping in

                          JunkhackerJ 1 Reply Last reply Reply Quote 0
                          • JunkhackerJ
                            Junkhacker Developer @zfeng
                            last edited by

                            @zfeng variables such as the host name are available for use scripting within FOS. this info comes from the host’s profile that gets created when you register a host with FOG.

                            signature:
                            Junkhacker
                            We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                            Z 1 Reply Last reply Reply Quote 0
                            • JunkhackerJ
                              Junkhacker Developer @zfeng
                              last edited by

                              @zfeng if you give some more info on what the script is actually doing, we might be able to help you find the best solution faster

                              signature:
                              Junkhacker
                              We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                              Z 1 Reply Last reply Reply Quote 0
                              • Z
                                zfeng @Junkhacker
                                last edited by

                                @Junkhacker hostname is part of the script. I also need to do something else such as downloading a particular file with specific variable passed from the argument

                                JunkhackerJ 1 Reply Last reply Reply Quote 0
                                • JunkhackerJ
                                  Junkhacker Developer @zfeng
                                  last edited by

                                  @zfeng this is very vague

                                  signature:
                                  Junkhacker
                                  We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                                  Z 1 Reply Last reply Reply Quote 0
                                  • Z
                                    zfeng @Junkhacker
                                    last edited by

                                    @Junkhacker the script will install different projects from git repository. everyone of the them needs to have an argument to install specific package on the computer.

                                    For now, after I complete the provision part, I basically power up the computer and run Computer=ComputerA ./start.sh on the home directory.

                                    1 Reply Last reply Reply Quote 0
                                    • Z
                                      zfeng @Junkhacker
                                      last edited by

                                      @Junkhacker I am sorry for not specific enough

                                      Tom ElliottT JunkhackerJ 2 Replies Last reply Reply Quote 0
                                      • Tom ElliottT
                                        Tom Elliott @zfeng
                                        last edited by

                                        @zfeng I’m guessing the image is Linux based?

                                        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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                        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

                                        Z 1 Reply Last reply Reply Quote 0
                                        • Z
                                          zfeng @Tom Elliott
                                          last edited by

                                          @Tom-Elliott Yes. You guys are very responsive. I appreciate that

                                          1 Reply Last reply Reply Quote 0
                                          • JunkhackerJ
                                            Junkhacker Developer @zfeng
                                            last edited by

                                            @zfeng it sounds like George’s method of creating a file in /etc/init.d on the target disk would work well for you. you can find info on creating postdownload scripts by searching on the forums

                                            signature:
                                            Junkhacker
                                            We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                                            Z 1 Reply Last reply Reply Quote 1
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post

                                            162

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project