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

    Adding custom advanced tasks or modifying existing ones?

    Scheduled Pinned Locked Moved
    FOG Problems
    3
    3
    2.8k
    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.
    • K
      Kazso
      last edited by

      Hi,

      Is it possible to add custom advanced tasks or modifying existing ones?
      I would like to add some more tasks to the task management to start Acronis products on specific hosts.
      Even modifying existing tasks would be great, because i don’t need most of them (ClamAV, Test Disk, Full Wipe, etc).
      I’ve already figured out, that these files are responsible for creating the tasks:

      /var/www/fog/commons/functions.include.php
      /var/www/fog/management/lib/Host.class.php
      /var/www/fog/management/includes/tasks.advanced.include.php (this one is the advanced task management page)

      I have the kernel and initrd files for various Acronis products and i can boot them fine using the PXE menu:

      LABEL fog.acrtrimg
      [INDENT=1]kernel fog/acronis/acrmem[/INDENT]
      [INDENT=1]append initrd=fog/acronis/acrtrimg quiet vga=0x314[/INDENT]
      [INDENT=1]MENU LABEL Acronis True Image Home[/INDENT]
      [INDENT=1]TEXT HELP[/INDENT]
      [INDENT=1]Boot Acronis True Image Home[/INDENT]
      [INDENT=1] [/INDENT]
      This one boots Acronis True Image Home (i renamed the original kernel to acrmem and the original initrd to acrtrimg).
      If i manually create a PXE file for a specific host (in /tftpboot/pxelinux.cfg) similar to what the task manager creates, then it works as well:

      DEFAULT send
      LABEL send
      kernel fog/acronis/acrmem
      append initrd=fog/acronis/acrtrimg quiet vga=0x314

      (I named this one 01-08-2e-5f-08-99-b7, because the mac is 08:2e:5f:88:99:b7)
      The problem with this method is that i must manually create the host specific PXE file myself everytime i want to automatically boot a host into a custom program (for example Acronis True Image Home), and manually delete the PXE file after it has loaded. Using the task manager would be more convenient.

      I tried to modify the ‘Test Disk’ task, and it works to some degree. The only problem is, that FOG won’t delete the task after it has finished (=the program booted successfully). I can kill the task on the ‘Active Tasks’ page though.
      The only thing i modified was the $output string in both functions.include.php and Host.class.php. I didn’t touch the task name, variables or anything else.

      $output = “DEFAULT send\n
      [INDENT=2]LABEL send\n[/INDENT]
      [INDENT=2]kernel fog/acronis/acrmem\n[/INDENT]
      [INDENT=2]append initrd=fog/acronis/acrtrimg quiet vga=0x314”;[/INDENT]
      [INDENT=2] [/INDENT]
      For me it seems that only FOG’s own tasks can work properly (which uses the FOG ramdisk), because custom tasks can’t report the status to the FOG server, and thus the tasks will never finish.
      Can anyone help me further with this?

      1 Reply Last reply Reply Quote 0
      • A
        aviad
        last edited by

        [quote=“Kazso, post: 2581, member: 817”]Hi,

        Is it possible to add custom advanced tasks or modifying existing ones?
        I would like to add some more tasks to the task management to start Acronis products on specific hosts.
        Even modifying existing tasks would be great, because i don’t need most of them (ClamAV, Test Disk, Full Wipe, etc).
        I’ve already figured out, that these files are responsible for creating the tasks:

        /var/www/fog/commons/functions.include.php
        /var/www/fog/management/lib/Host.class.php
        /var/www/fog/management/includes/tasks.advanced.include.php (this one is the advanced task management page)

        I have the kernel and initrd files for various Acronis products and i can boot them fine using the PXE menu:

        LABEL fog.acrtrimg
        [INDENT=1]kernel fog/acronis/acrmem[/INDENT]
        [INDENT=1]append initrd=fog/acronis/acrtrimg quiet vga=0x314[/INDENT]
        [INDENT=1]MENU LABEL Acronis True Image Home[/INDENT]
        [INDENT=1]TEXT HELP[/INDENT]
        [INDENT=1]Boot Acronis True Image Home[/INDENT]
        [INDENT=1] [/INDENT]
        This one boots Acronis True Image Home (i renamed the original kernel to acrmem and the original initrd to acrtrimg).
        If i manually create a PXE file for a specific host (in /tftpboot/pxelinux.cfg) similar to what the task manager creates, then it works as well:

        DEFAULT send
        LABEL send
        kernel fog/acronis/acrmem
        append initrd=fog/acronis/acrtrimg quiet vga=0x314

        (I named this one 01-08-2e-5f-08-99-b7, because the mac is 08:2e:5f:88:99:b7)
        The problem with this method is that i must manually create the host specific PXE file myself everytime i want to automatically boot a host into a custom program (for example Acronis True Image Home), and manually delete the PXE file after it has loaded. Using the task manager would be more convenient.

        I tried to modify the ‘Test Disk’ task, and it works to some degree. The only problem is, that FOG won’t delete the task after it has finished (=the program booted successfully). I can kill the task on the ‘Active Tasks’ page though.
        The only thing i modified was the $output string in both functions.include.php and Host.class.php. I didn’t touch the task name, variables or anything else.

        $output = “DEFAULT send\n
        [INDENT=2]LABEL send\n[/INDENT]
        [INDENT=2]kernel fog/acronis/acrmem\n[/INDENT]
        [INDENT=2]append initrd=fog/acronis/acrtrimg quiet vga=0x314”;[/INDENT]
        [INDENT=2] [/INDENT]
        For me it seems that only FOG’s own tasks can work properly (which uses the FOG ramdisk), because custom tasks can’t report the status to the FOG server, and thus the tasks will never finish.
        Can anyone help me further with this?[/quote]

        I may be a bit late to the party, but how about this:
        [url]http://www.howtogeek.com/57601/what-is-network-booting-pxe-and-how-can-you-use-it/[/url]
        Hope it helped…

        1 Reply Last reply Reply Quote 0
        • N
          networkguy
          last edited by

          For the custom task to clear itself from Active Tasks you may be able to switch out pxelinux with ipxe. Using the following embedded script to undionly.kpxe will send the mac to a php script on your web server which can delete the task. This method would delete the active task before it has finished though which may not be desirable in your environment.

          -fogboot.ipxe

          [CODE]#!ipxe
          dhcp
          chain http://1.1.1.1/images/boot.php?mac=${net0/mac}&asset=${asset:uristring}
          boot[/CODE]

          -build command
          [CODE]make bin/undionly.kpxe EMBED=fogboot.ipxe[/CODE]

          -sample boot.php
          [CODE]<?php
          $mac = urldecode($_GET[‘mac’]);
          // Do some stuff with the mac here…

          $fogServer = “1.1.1.1”;
          $kernel = “images/bzImage”;
          $kernelOptions = “root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp dns= mode=onlydebug”
          $initrd = “images/init.gz”;

          echo writeIPXE($fogServer, $kernel, $kernelOptions, $initrd);

          function writeIPXE($fogServer, $kernel, $kernelOptions, $initrd){
          $ipxe = <<<DOC
          #!ipxe
          kernel http://$fogServer/$kernel $kernelOptions
          initrd http://$fogServer/$initrd
          boot
          DOC;
          return $ipxe;
          }
          ?>[/CODE]

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

          258

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project