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

Provision with Script

Scheduled Pinned Locked Moved Solved
Feature Request
4
33
5.6k
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 @george1421
    last edited by Jan 9, 2020, 8:42 PM

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

    G 1 Reply Last reply Jan 9, 2020, 8:49 PM Reply Quote 0
    • G
      george1421 Moderator @zfeng
      last edited by george1421 Jan 9, 2020, 2:47 PM Jan 9, 2020, 8:45 PM

      @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 Jan 9, 2020, 9:13 PM Reply Quote 0
      • G
        george1421 Moderator @zfeng
        last edited by Jan 9, 2020, 8:49 PM

        @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!

        J 1 Reply Last reply Jan 9, 2020, 9:09 PM Reply Quote 0
        • J
          Junkhacker Developer @george1421
          last edited by Jan 9, 2020, 9:09 PM

          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 Jan 9, 2020, 9:15 PM Reply Quote 0
          • Z
            zfeng @george1421
            last edited by Jan 9, 2020, 9:13 PM

            @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?

            J 1 Reply Last reply Jan 9, 2020, 9:15 PM Reply Quote 0
            • Z
              zfeng @Junkhacker
              last edited by Jan 9, 2020, 9:15 PM

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

              J 1 Reply Last reply Jan 9, 2020, 9:16 PM Reply Quote 0
              • J
                Junkhacker Developer @zfeng
                last edited by Jan 9, 2020, 9:15 PM

                @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 Jan 9, 2020, 9:18 PM Reply Quote 0
                • J
                  Junkhacker Developer @zfeng
                  last edited by Jan 9, 2020, 9:16 PM

                  @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 Jan 9, 2020, 9:21 PM Reply Quote 0
                  • Z
                    zfeng @Junkhacker
                    last edited by Jan 9, 2020, 9:18 PM

                    @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

                    J 1 Reply Last reply Jan 9, 2020, 9:20 PM Reply Quote 0
                    • J
                      Junkhacker Developer @zfeng
                      last edited by Jan 9, 2020, 9:20 PM

                      @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 Jan 9, 2020, 9:23 PM Reply Quote 0
                      • Z
                        zfeng @Junkhacker
                        last edited by Jan 9, 2020, 9:21 PM

                        @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 Jan 9, 2020, 9:23 PM

                          @Junkhacker I am sorry for not specific enough

                          T J 2 Replies Last reply Jan 9, 2020, 9:24 PM Reply Quote 0
                          • T
                            Tom Elliott @zfeng
                            last edited by Jan 9, 2020, 9:24 PM

                            @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 Jan 9, 2020, 9:25 PM Reply Quote 0
                            • Z
                              zfeng @Tom Elliott
                              last edited by Jan 9, 2020, 9:25 PM

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

                              1 Reply Last reply Reply Quote 0
                              • J
                                Junkhacker Developer @zfeng
                                last edited by Jan 9, 2020, 9:26 PM

                                @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 Jan 9, 2020, 9:27 PM Reply Quote 1
                                • Z
                                  zfeng @Junkhacker
                                  last edited by Jan 9, 2020, 9:27 PM

                                  @Junkhacker but how can I pass the argument to that script?

                                  T J 2 Replies Last reply Jan 9, 2020, 9:28 PM Reply Quote 0
                                  • T
                                    Tom Elliott @zfeng
                                    last edited by Jan 9, 2020, 9:28 PM

                                    @zfeng so if you use post download script you could auto set your start script to have the host name preset

                                    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 Jan 9, 2020, 9:49 PM Reply Quote 0
                                    • J
                                      Junkhacker Developer @zfeng
                                      last edited by Jan 9, 2020, 9:39 PM

                                      @zfeng you could do something like wget -o /root/script.sh <address>/script.sh; echo “Computer=$hostname /root/script.sh” > <drive mount point>/etc/init.d/oneshot.sh

                                      something like that.

                                      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 Jan 9, 2020, 9:57 PM Reply Quote 1
                                      • Z
                                        zfeng @Tom Elliott
                                        last edited by Jan 9, 2020, 9:49 PM

                                        @Tom-Elliott The best thing I can do now is to try out that, and see what comes. Let’s say I need provision a linux computer with script Computer=ComputerA ./start.sh on the home directory. Is there any instruction I can try that out?

                                        1 Reply Last reply Reply Quote 0
                                        • Z
                                          zfeng @Junkhacker
                                          last edited by Jan 9, 2020, 9:57 PM

                                          @Junkhacker where should I specify wget -o /root/script.sh <address>/script.sh; echo “Computer=$hostname /root/script.sh” > <drive mount point>/etc/init.d/oneshot.sh command?

                                          J 1 Reply Last reply Jan 9, 2020, 10:00 PM Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          1 / 2
                                          • First post
                                            17/33
                                            Last post

                                          140

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project