FOG With BASH
-
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.
-
@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.
-
@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.
-
@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." -
@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?
-
@Arrowhead-IT
Yes you understand correctly. -
@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-restoreUsing 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.
-
@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
-
@Arrowhead-IT
Thank you very much. -
@Wayne-Workman
thank you very much.