Tacoen's shared code-snipsets
#!/usr/bin/perl # require common rutins. my $USER = $ARGV[0]; my $DOMAIN = $ARGV[1]; &error(1) if (!$USER || !$DOMAIN); $thepath = "/var/www/$USER"; system "useradd $USER -d $thepath -s /bin/bash"; system "mkdir $thepath" if (!-e $thepath); system "mkdir $thepath/.log"; system "mkdir $thepath/.tmp"; $vhostconf = &load_as_string("/yourpath/vhost-prop/vhost.txt"); $vhostconf =~ s/\%DOMAIN\%/$DOMAIN/gi; $vhostconf =~ s/\%USER\%/$USER/gi; &save_file("/yourpath/vhost.d/$USER.conf",$vhostconf,0); $logrotate = &load_as_string("/yourpath/vhost-prop/log.txt"); $logrotate =~ s/\%USER\%/$USER/gi; &save_file("/etc/logrotate.d/httpd-$USER",$logrotate,0); $phpini = &load_as_string("/yourpath/vhost-prop/php.ini.txt"); $phpini =~ s/\%USER\%/$USER/gi; &save_file("$thepath/php.ini",$phpini,0); system "cp -f /yourpath/vhost-prop/favicon.ico $thepath"; system "cp -f /yourpath/vhost-prop/robots.txt $thepath"; system "chmod 755 $thepath"; system "touch $thepath/.log/access.log"; system "touch $thepath/.log/error.log"; system "chmod 755 $thepath/.log"; system "chmod 755 $thepath/.tmp"; system "chown $USER:$USER $thepath -R"; #$newrec = "$USER CNAME farm\n"; #$dnshead = &load_as_string("/yourpath/vhost-prop/in-dns.txt")."\n".$newrec; #$serial = &serialize(); #$dnshead =~ s/\%SERIAL\%/$serial/gi; #&save_file("/yourpath/vhost-prop/in-dns.txt",$newrec,1); #&save_file("/var/named/yourdomains.dns",$dnshead); #system "rndc reload yourdomains.net"; system "passwd $USER"; exit; sub error { my $e = shift; print "syntax: $ARGV[0] [user] [domain]\n" if ($e == 1); exit; }template vhost dan dns tidak ada disini.
Posting Komentar