The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom templates that will apply to a single virtual host when rebuilding an existing

Discussion in 'General Discussion' started by haulpd, May 27, 2011.

  1. haulpd

    haulpd Member

    Joined:
    May 20, 2011
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    I do like the link below:

    Changes Contained within a VirtualHost Directive

    but i don't understand step 5 where:

    Code:
    Use the following script to add the necessary information to the data structure:
    
        perl -MYAML::Syck -e 'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' /var/cpanel/userdata/$username/$domainname $key $path/to/template 
    how to do this ?

    Thanks
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,808
    Likes Received:
    667
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: Custom templates that will apply to a single virtual host when rebuilding an exis

    Hello :)

    You would simply run the following via the command line as root:

    Code:
    perl -MYAML::Syck -e 'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' /var/cpanel/userdata/$username/$domainname $key $path/to/template
    Any value that begins with the "$" symbol, you would replace that with the specific entry. EX:

    "$username" would be replaced with the actual cPanel username.
    "$domainname" would be replaced with the domain name you are editing the VirtualHost for.
    "$path/to/template" would be replaced with the exact path to the template file moved during step 4.

    The $key value should be:

    custom_vhost_template_ap1 for Apache 1
    custom_vhost_template_ap2 for Apache 2

    Let's say you were making this change for the "test01.com" domain name on the "test01" account and the system uses Apache 2. The custom template file from step 4 would have been moved to "/var/cpanel/templates/custom-directory/vhost.local" in this scenario. The command would be:

    Code:
    perl -MYAML::Syck -e 'my $hr = YAML::Syck::LoadFile($ARGV[0]);$hr->{$ARGV[1]} = $ARGV[2];YAML::Syck::DumpFile($ARGV[0],$hr);' /var/cpanel/userdata/test01/test01.com custom_vhost_template_ap2 /var/cpanel/templates/custom-directory/vhost.local
    
    Thank you.
     
Loading...

Share This Page