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

    FOG With BASH

    Scheduled Pinned Locked Moved
    General
    4
    13
    4.5k
    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.
    • N
      Nika
      last edited by

      Hello.
      I have FOG 1.2.0

      How can i WIPE hard disk with Bash or Python in Linux? (fog WIPE any computer)
      How can i restore any image with command line of Linux?
      and how can i delete COMPUTERS with Bash or Python in Linux ?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • Wayne WorkmanW
        Wayne Workman
        last edited by

        Do you have FOG 1.2.0 working? It can do all these things already.

        Why do you want bash commands for those things?

        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!
        Daily Clean Installation Results:
        https://fogtesting.fogproject.us/
        FOG Reporting:
        https://fog-external-reporting-results.fogproject.us/

        J 1 Reply Last reply Reply Quote 0
        • Wayne WorkmanW
          Wayne Workman
          last edited by

          Oh this request is regarding this: https://forums.fogproject.org/topic/6454/wipe-and-restore

          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!
          Daily Clean Installation Results:
          https://fogtesting.fogproject.us/
          FOG Reporting:
          https://fog-external-reporting-results.fogproject.us/

          1 Reply Last reply Reply Quote 0
          • JJ FullmerJ
            JJ Fullmer Testers
            last edited by

            So you can do these things in the gui with much ease. I’m guessing you’re trying to write a script of some sort to automate it further?
            If you run a debug session then you can run any of those commands on the computer you’re imaging with things like fog.wipe and fog.download.

            Since the actions you make in the gui are essentially doing things in the database, I suppose that it would be possible to manually edit the database with a script to queue the actions you want on the computers you want. But I don’t know the database well enough to help much more than point you in that direction.

            What exactly are you trying to do though? You can set up cron style jobs in the gui if you are trying to just have wipes and restores done regularly, you could set that up in the gui without custom code. Just select cron style deployment when you queue a job in the gui.

            Hopefully that’s helpful in some way.

            Have you tried the FogApi powershell module? It's pretty cool IMHO
            https://github.com/darksidemilk/FogApi
            https://fogapi.readthedocs.io/en/latest/
            https://www.powershellgallery.com/packages/FogApi
            https://forums.fogproject.org/topic/12026/powershell-api-module

            Wayne WorkmanW 1 Reply Last reply Reply Quote 1
            • Wayne WorkmanW
              Wayne Workman @JJ Fullmer
              last edited by

              @Arrowhead-IT said:

              Since the actions you make in the gui are essentially doing things in the database, I suppose that it would be possible to manually edit the database with a script to queue the actions you want on the computers you want.

              I outlined how it’d be done in the thread I posted below.

              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!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              JJ FullmerJ 1 Reply Last reply Reply Quote 1
              • JJ FullmerJ
                JJ Fullmer Testers @Wayne Workman
                last edited by

                @Wayne-Workman I see that now, You posted while I was writing my post so I didn’t see that. I got distracted whilst writing it.

                Have you tried the FogApi powershell module? It's pretty cool IMHO
                https://github.com/darksidemilk/FogApi
                https://fogapi.readthedocs.io/en/latest/
                https://www.powershellgallery.com/packages/FogApi
                https://forums.fogproject.org/topic/12026/powershell-api-module

                1 Reply Last reply Reply Quote 1
                • J
                  jc35 @Wayne Workman
                  last edited by

                  @Wayne-Workman said:

                  Do you have FOG 1.2.0 working? It can do all these things already.
                  Yes we have FOG 1.2.0 working.

                  Why do you want bash commands for those things?

                  We need to automate some actions. We use glpi and rabbit mq.
                  when we put a machine discarded with glpi, rabbit mq send to fog " a wipe and imaging and delete a machine."

                  JJ FullmerJ 1 Reply Last reply Reply Quote 1
                  • JJ FullmerJ
                    JJ Fullmer Testers @jc35
                    last edited by

                    @jc35 Just to be sure I understand what you’re trying to do,
                    You have an inventory system in glpi.
                    You want to make it so if you hit delete on a computer in your inventory rabbit mq sends a message to fog to wipe the machine and put a default image (like a retail windows or basic linux that the computer can be sold with I’m guessing) on the deleted computer.

                    So you want to click one button to delete the computer from your inventory and it automatically prepares itself to be safely disposed/surplussed/sold or what have you.

                    Do I understand correctly?

                    Have you tried the FogApi powershell module? It's pretty cool IMHO
                    https://github.com/darksidemilk/FogApi
                    https://fogapi.readthedocs.io/en/latest/
                    https://www.powershellgallery.com/packages/FogApi
                    https://forums.fogproject.org/topic/12026/powershell-api-module

                    J 1 Reply Last reply Reply Quote 1
                    • J
                      jc35 @JJ Fullmer
                      last edited by

                      @Arrowhead-IT
                      Yes you understand correctly.

                      JJ FullmerJ 1 Reply Last reply Reply Quote 0
                      • JJ FullmerJ
                        JJ Fullmer Testers @jc35
                        last edited by

                        @jc35 So I think you can do this
                        I would follow the help @Wayne-Workman gave you on this post
                        https://forums.fogproject.org/topic/6454/wipe-and-restore

                        Using the information of what the database tables need to say you could write a bash or python script to edit the mysql database of fog.
                        The next question is whether or not you need help with that part too.
                        The basics steps you would need to do

                        • make a remote mysql user with access to the fog database on the fog server.
                        • Compose and test some mysql commands remotely based on the tables you need to edit and make sure it works
                        • Take those commands and put them into a script. In bash it is possible to send a single command to mysql, I don’t remember the parameter of the top of my head though, I would have to go find a script where I did that if need be.

                        Hopefully that helps you get started.

                        Have you tried the FogApi powershell module? It's pretty cool IMHO
                        https://github.com/darksidemilk/FogApi
                        https://fogapi.readthedocs.io/en/latest/
                        https://www.powershellgallery.com/packages/FogApi
                        https://forums.fogproject.org/topic/12026/powershell-api-module

                        Wayne WorkmanW J 2 Replies Last reply Reply Quote 1
                        • Wayne WorkmanW
                          Wayne Workman @JJ Fullmer
                          last edited by

                          @Arrowhead-IT said:

                          In bash it is possible to send a single command to mysql, I don’t remember the parameter of the top of my head though, I would have to go find a script where I did that if need be.

                          Some good references:

                          http://stackoverflow.com/questions/20033648/how-to-run-mysql-command-on-bash

                          http://stackoverflow.com/questions/1636977/bash-script-select-from-database-into-variable

                          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!
                          Daily Clean Installation Results:
                          https://fogtesting.fogproject.us/
                          FOG Reporting:
                          https://fog-external-reporting-results.fogproject.us/

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            jc35 @JJ Fullmer
                            last edited by

                            @Arrowhead-IT
                            Thank you very much.

                            1 Reply Last reply Reply Quote 1
                            • J
                              jc35 @Wayne Workman
                              last edited by

                              @Wayne-Workman
                              thank you very much.

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

                              256

                              Online

                              12.0k

                              Users

                              17.3k

                              Topics

                              155.2k

                              Posts
                              Copyright © 2012-2024 FOG Project