GregT
February 14th, 2003, 22:06
i dont understand why no workie :( help me fix !
#!/usr/bin/perl
################################
## Host Panel 0.1 ALPHA ##
## Copyright 2003 Yupadog.com ##
################################
my $htconf = "/usr/local/etc/apache/httpd.conf";
my $packages;
my $homepath = "/usr/home";
while(<>){
if ($_ == "free"){ $packages = "free"; }
if ($_ == "bronze"){ $packages = "bronze"; }
if ($_ == "silver"){ $packages = "silver"; }
if ($_ == "gold"){ $packages = "gold"; }
else { die("Usage: hostp package\n free, bronze, silver, or gold\n"); }
}
## add ftp account ##
print "Enter username: ";
chomp($username = <STDIN>);
if ($packages == "free"){ $space = "100"; }
if ($packages == "bronze"){ $space = "200"; }
if ($packages == "silver"){ $space = "300"; }
if ($packages == "gold"){ $space = "400"; }
else { die("Something bad happened"); }
system("pure-pw adduser $username -d /home/$username -N $space -u ftp -m");
print "FTP Account created. Setting up apache...";
# build virtualhost directives and create directories
print "Enter (sub)domain name: ";
chomp($domain = <STDIN>);
my $fullpath = "$home_path/$domain";
my $user = "ftp";
my $directives .= <<EOF;
<VirtualHost *>
ServerName $domain
ServerAlias $domain *.$domain
DocumentRoot $fullpath/www
ErrorLog $fullpath/logs/error_log.log
LogLevel info
DirectoryIndex index.html index.htm index.php index.php3 home.htm home.html
</VirtualHost>
EOF
# create directories
system("mkdir $fullpath");
system("mkdir $fullpath/www");
system("mkdir $fullpath/logs");
system("chown $user:$user $fullpath -R");
system("chmod 755 $fullpath -R");
open(HTCONF, ">>$htconf")
or die("Couldn't open $htconf for writing. $!");
print HTCONF $directives;
close(HTCONF);
print "Setup Complete, everything done successfully !\n Now restarting apache...\n";
system("apachectl restart");
__END__
#!/usr/bin/perl
################################
## Host Panel 0.1 ALPHA ##
## Copyright 2003 Yupadog.com ##
################################
my $htconf = "/usr/local/etc/apache/httpd.conf";
my $packages;
my $homepath = "/usr/home";
while(<>){
if ($_ == "free"){ $packages = "free"; }
if ($_ == "bronze"){ $packages = "bronze"; }
if ($_ == "silver"){ $packages = "silver"; }
if ($_ == "gold"){ $packages = "gold"; }
else { die("Usage: hostp package\n free, bronze, silver, or gold\n"); }
}
## add ftp account ##
print "Enter username: ";
chomp($username = <STDIN>);
if ($packages == "free"){ $space = "100"; }
if ($packages == "bronze"){ $space = "200"; }
if ($packages == "silver"){ $space = "300"; }
if ($packages == "gold"){ $space = "400"; }
else { die("Something bad happened"); }
system("pure-pw adduser $username -d /home/$username -N $space -u ftp -m");
print "FTP Account created. Setting up apache...";
# build virtualhost directives and create directories
print "Enter (sub)domain name: ";
chomp($domain = <STDIN>);
my $fullpath = "$home_path/$domain";
my $user = "ftp";
my $directives .= <<EOF;
<VirtualHost *>
ServerName $domain
ServerAlias $domain *.$domain
DocumentRoot $fullpath/www
ErrorLog $fullpath/logs/error_log.log
LogLevel info
DirectoryIndex index.html index.htm index.php index.php3 home.htm home.html
</VirtualHost>
EOF
# create directories
system("mkdir $fullpath");
system("mkdir $fullpath/www");
system("mkdir $fullpath/logs");
system("chown $user:$user $fullpath -R");
system("chmod 755 $fullpath -R");
open(HTCONF, ">>$htconf")
or die("Couldn't open $htconf for writing. $!");
print HTCONF $directives;
close(HTCONF);
print "Setup Complete, everything done successfully !\n Now restarting apache...\n";
system("apachectl restart");
__END__