Categories
Linux

FOG: Deleting all current active tasks

FOG is “a free computer cloning solution” found at http://www.fogproject.org/. If your a seasoned user you will no doubt have groups setup so you may run commands on multiple machine without loading each one individually. In my scenario we have 1000 machines that need to be imaged, easy, I just created a group with those particular machines (luckily most computers will have a common part of their MAC address so I could search for machines based on manufacturer). Once the group was created I then setup a task for that group to deploy an image.

OK, whoops, this is when you realise that the machines has the wrong image id assigned to them. Easy you think, you created the task as a group you can just as easily delete the active task as a group. No such luck here, what FOG will do to a group of computers is simply setup an individual task for each and every machine in the group. So your only option now is to click delete on each active task, now multiply this out to 1000 machines you have an annoying problem.

There is a simple solution, although a word of warning here “PLEASE MAKE SURE YOU HAVE A BACKUP”. All the tasks are contained within the “tasks” table within MySQL. So if you feel comfortable crack open a console connection and open up a console to MySQL.

root@fog:/# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or g.
Server version: 5.0.67-0ubuntu6.1 (Ubuntu)

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> use fog;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> delete from tasks where taskState = 0;
Query OK, 8 rows affected (0.23 sec)

mysql>

This will delete all the active tasks running on the fog server. However the command files will still exist in the TFTPROOT folder. Exit out from MySQL and change directory into your TFTPROOT folder. Once inside change into the pxelinux.cfg folder.

You will notice several files in this directory, these are the files that control what a machine will do once it is PXE booted. To delete the command files you ONLY have to delete the files starting with “01-“, this is import as the other files will tell the machines what to do when they don’t have any active tasks.

root@fog:/tftpboot/pxelinux.cfg# rm 01-*

This will have completely removed all the active tasks.