Last active
March 5, 2022 23:39
-
-
Save cameroncking/29b0b21bd42eb6da5d0e8db5aa58a669 to your computer and use it in GitHub Desktop.
Magento Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Copyright 2012 Cameron King. ISC License | |
use strict; | |
use warnings; | |
# changelog | |
# 1.00 - initial version | |
# 1.01 - change apc.include_once_override to 0 | |
sub block2 { | |
my $txt = shift(@_); | |
my $out = ''; | |
$out .= sprintf(" %s\n", $_) foreach(split(/\n/, $txt)); | |
return($out); | |
} | |
sub step { | |
my ($num, $cmd) = @_; | |
my $out = `$cmd`; | |
printf("---\nstep: %d\ncommand: %s\nreturn: %d\n", $num, $cmd, ${^CHILD_ERROR_NATIVE}); | |
printf("output: |2\n%s\n", block2($out)); | |
} | |
sub tmpfile { | |
my ($num, $txt) = @_; | |
my $rand_hex = join "", map { unpack "H*", chr(rand(256)) } 1..16; | |
my $fn = sprintf("/tmp/tmp.megento-optimize.%d.%s", $$, $rand_hex); | |
open(TF, ">$fn"); | |
print(TF $txt); | |
close(TF); | |
printf("---\nstep: %d\ntmpfile: %s\ncontent: |2\n%s\n", $num, $fn, block2($txt)); | |
return($fn); | |
} | |
sub rm { | |
my ($num, $fn) = @_; | |
unlink($fn); | |
printf("---\nstep: %d\nrm: %s\n\n", $num, $fn); | |
} | |
### MEMCACHED | |
die 'install memcached first' unless -e '/etc/memcached.conf'; | |
my $num=0; | |
my $tmpf=''; | |
for my $mcnum(2..9) { | |
next if -e "/etc/memcached$mcnum.conf"; | |
step(++$num, '/usr/bin/apt-get install memcached php5-memcache'); | |
unless(-e '/etc/memcached'.$mcnum.'.conf') { | |
step(++$num, '/bin/cp /etc/memcached.conf /etc/memcached'.$mcnum.'.conf'); | |
} | |
unless(-e '/etc/init.d/memcached'.$mcnum) { | |
step(++$num, '/bin/cp /etc/init.d/memcached /etc/init.d/memcached'.$mcnum); | |
} | |
unless(-e '/etc/default/memcached'.$mcnum) { | |
step(++$num, '/bin/cp /etc/default/memcached /etc/default/memcached'.$mcnum); | |
} | |
$_ = <<"TXT"; | |
--- /etc/memcached2.conf 2012-06-04 13:43:32.322150287 -0700 | |
+++ memcached.conf 2012-06-04 13:48:07.718069896 -0700 | |
\@\@ -23,7 +23,7 \@\@ | |
-m 64 | |
# Default connection port is 11211 | |
--p 11211 | |
+-p 1121$mcnum | |
# Run the daemon as root. The start-memcached will default to running as root if no | |
# -u command is present in this config file | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /etc/memcached'.$mcnum.'.conf <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
$_ = <<"TXT"; | |
--- /etc/init.d/memcached 2010-05-12 02:41:51.000000000 -0700 | |
+++ memcached2 2012-06-04 15:58:29.794071143 -0700 | |
\@\@ -1,22 +1,22 \@\@ | |
#! /bin/sh | |
### BEGIN INIT INFO | |
-# Provides: memcached | |
+# Provides: memcached$mcnum | |
# Required-Start: \$remote_fs \$syslog | |
# Required-Stop: \$remote_fs \$syslog | |
# Should-Start: \$local_fs | |
# Should-Stop: \$local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
-# Short-Description: Start memcached daemon | |
-# Description: Start up memcached, a high-performance memory caching daemon | |
+# Short-Description: Start memcached$mcnum daemon | |
+# Description: Start up memcached$mcnum, a high-performance memory caching daemon | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/bin/memcached | |
-DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached | |
-NAME=memcached | |
-DESC=memcached | |
+DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached$mcnum | |
+NAME=memcached$mcnum | |
+DESC=memcached$mcnum | |
PIDFILE=/var/run/\$NAME.pid | |
test -x \$DAEMON || exit 0 | |
@@ -37,7 +37,7 @@ | |
start-stop-daemon --start --quiet --exec \$DAEMONBOOTSTRAP | |
echo "\$NAME." | |
else | |
- echo "\$NAME disabled in /etc/default/memcached." | |
+ echo "\$NAME disabled in /etc/default/memcached$mcnum." | |
fi | |
;; | |
stop) | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /etc/init.d/memcached'.$mcnum.' <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
unless(-e '/usr/share/memcached/scripts/start-memcached'.$mcnum) { | |
step(++$num, '/bin/cp /usr/share/memcached/scripts/start-memcached /usr/share/memcached/scripts/start-memcached'.$mcnum); | |
} | |
$_ = <<"TXT"; | |
--- /usr/share/memcached/scripts/start-memcached 2010-05-12 02:41:51.000000000 -0700 | |
+++ start-memcached 2012-06-04 15:55:00.074071432 -0700 | |
@@ -15,13 +15,13 @@ | |
exit; | |
} | |
-my \$params; my \$etchandle; my \$etcfile = "/etc/memcached.conf"; | |
+my \$params; my \$etchandle; my \$etcfile = "/etc/memcached$mcnum.conf"; | |
# This script assumes that memcached is located at /usr/bin/memcached, and | |
# that the pidfile is writable at /var/run/memcached.pid | |
my \$memcached = "/usr/bin/memcached"; | |
-my \$pidfile = "/var/run/memcached.pid"; | |
+my \$pidfile = "/var/run/memcached$mcnum.pid"; | |
# If we don't get a valid logfile parameter in the /etc/memcached.conf file, | |
# we'll just throw away all of our in-daemon output. We need to re-tie it so | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /usr/share/memcached/scripts/start-memcached'.$mcnum.' <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
foreach my $rl(qw( 0 1 6 )) { | |
unless(-e sprintf("/etc/rc%d.d/S22memcached$mcnum", $rl) || -e sprintf("/etc/rc%d.d/K02memcached$mcnum", $rl)) { | |
step(++$num, sprintf("/bin/ln -s /etc/init.d/memcached$mcnum /etc/rc%d.d/K02memcached$mcnum", $rl)); | |
} | |
} | |
foreach my $rl(qw( 2 3 4 5 )) { | |
unless(-e sprintf("/etc/rc%d.d/S22memcached$mcnum", $rl) || -e sprintf("/etc/rc%d.d/K02memcached$mcnum", $rl)) { | |
step(++$num, sprintf("/bin/ln -s /etc/init.d/memcached$mcnum /etc/rc%d.d/S22memcached$mcnum", $rl)); | |
} | |
} | |
step(++$num, '/usr/sbin/update-rc.d memcached'.$mcnum.' enable'); | |
step(++$num, '/etc/init.d/memcached'.$mcnum.' restart'); | |
last; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Copyright 2012 Cameron King. ISC License | |
use strict; | |
use warnings; | |
# changelog | |
# 1.00 - initial version | |
# 1.01 - change apc.include_once_override to 0 | |
sub block2 { | |
my $txt = shift(@_); | |
my $out = ''; | |
$out .= sprintf(" %s\n", $_) foreach(split(/\n/, $txt)); | |
return($out); | |
} | |
sub step { | |
my ($num, $cmd) = @_; | |
my $out = `$cmd`; | |
printf("---\nstep: %d\ncommand: %s\nreturn: %d\n", $num, $cmd, ${^CHILD_ERROR_NATIVE}); | |
printf("output: |2\n%s\n", block2($out)); | |
} | |
sub tmpfile { | |
my ($num, $txt) = @_; | |
my $rand_hex = join "", map { unpack "H*", chr(rand(256)) } 1..16; | |
my $fn = sprintf("/tmp/tmp.megento-optimize.%d.%s", $$, $rand_hex); | |
open(TF, ">$fn"); | |
print(TF $txt); | |
close(TF); | |
printf("---\nstep: %d\ntmpfile: %s\ncontent: |2\n%s\n", $num, $fn, block2($txt)); | |
return($fn); | |
} | |
sub rm { | |
my ($num, $fn) = @_; | |
unlink($fn); | |
printf("---\nstep: %d\nrm: %s\n\n", $num, $fn); | |
} | |
### INSTALL APC | |
my $num=0; | |
step(++$num, '/usr/bin/apt-get install apache-php ftp mysql php-apc'); | |
$_=<<'TXT'; | |
--- /etc/php5/apache2/conf.d/apc.ini 2010-04-03 16:52:40.000000000 -0700 | |
+++ apc.ini 2012-06-04 10:05:38.186071302 -0700 | |
@@ -1 +1,3 @@ | |
extension=apc.so | |
+apc.shm_size=128 | |
+apc.include_once_override=0 | |
TXT | |
my $tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf("/usr/bin/patch -r- /etc/php5/apache2/conf.d/apc.ini <%s", $tmpf)); | |
rm(++$num, $tmpf); | |
### SETUP APACHE | |
step(++$num, '/usr/sbin/usermod -aG vhosts www-data'); | |
$_=<<'TXT'; | |
--- /etc/apache2/vhost-write-level.conf 2007-08-27 17:05:03.000000000 -0700 | |
+++ vhost-write-level.conf 2012-06-04 10:14:20.842071167 -0700 | |
@@ -8,6 +8,6 @@ | |
# to apply the change to all vhosts on the machine. # | |
############################################################################## | |
-VHOST_WRITE_LEVEL=user | |
-#VHOST_WRITE_LEVEL=group | |
+#VHOST_WRITE_LEVEL=user | |
+VHOST_WRITE_LEVEL=group | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf("/usr/bin/patch -r- /etc/apache2/vhost-write-level.conf <%s", $tmpf)); | |
rm(++$num, $tmpf); | |
rm(++$num, '/etc/apache2/mods-enabled/suphp.conf'); | |
rm(++$num, '/etc/apache2/mods-enabled/suphp.load'); | |
step(++$num, '/bin/ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/'); | |
step(++$num, '/etc/init.d/apache2 reload'); | |
### MEMCACHED | |
step(++$num, '/usr/bin/apt-get install memcached php5-memcache'); | |
unless(-e '/etc/memcached2.conf') { | |
step(++$num, '/bin/cp /etc/memcached.conf /etc/memcached2.conf'); | |
} | |
unless(-e '/etc/init.d/memcached2') { | |
step(++$num, '/bin/cp /etc/init.d/memcached /etc/init.d/memcached2'); | |
} | |
unless(-e '/etc/default/memcached2') { | |
step(++$num, '/bin/cp /etc/default/memcached /etc/default/memcached2'); | |
} | |
$_ = <<'TXT'; | |
--- /etc/memcached.conf 2012-06-04 10:20:07.533967901 -0700 | |
+++ memcached.conf 2012-06-04 13:34:10.110071117 -0700 | |
@@ -20,7 +20,7 @@ | |
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default | |
# Note that the daemon will grow to this size, but does not start out holding this much | |
# memory | |
--m 64 | |
+-m 256 | |
# Default connection port is 11211 | |
-p 11211 | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch -r- /etc/memcached.conf <%s', $tmpf)); | |
step(++$num, sprintf('/usr/bin/patch -r- /etc/memcached2.conf <%s', $tmpf)); | |
rm($tmpf); | |
$_ = <<'TXT'; | |
--- /etc/memcached2.conf 2012-06-04 13:43:32.322150287 -0700 | |
+++ memcached.conf 2012-06-04 13:48:07.718069896 -0700 | |
@@ -23,7 +23,7 @@ | |
-m 256 | |
# Default connection port is 11211 | |
--p 11211 | |
+-p 11212 | |
# Run the daemon as root. The start-memcached will default to running as root if no | |
# -u command is present in this config file | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /etc/memcached2.conf <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
$_ = <<'TXT'; | |
--- /etc/init.d/memcached 2010-05-12 02:41:51.000000000 -0700 | |
+++ memcached2 2012-06-04 15:58:29.794071143 -0700 | |
@@ -1,22 +1,22 @@ | |
#! /bin/sh | |
### BEGIN INIT INFO | |
-# Provides: memcached | |
+# Provides: memcached2 | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
-# Short-Description: Start memcached daemon | |
-# Description: Start up memcached, a high-performance memory caching daemon | |
+# Short-Description: Start memcached2 daemon | |
+# Description: Start up memcached2, a high-performance memory caching daemon | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/bin/memcached | |
-DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached | |
-NAME=memcached | |
-DESC=memcached | |
+DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached2 | |
+NAME=memcached2 | |
+DESC=memcached2 | |
PIDFILE=/var/run/$NAME.pid | |
test -x $DAEMON || exit 0 | |
@@ -37,7 +37,7 @@ | |
start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP | |
echo "$NAME." | |
else | |
- echo "$NAME disabled in /etc/default/memcached." | |
+ echo "$NAME disabled in /etc/default/memcached2." | |
fi | |
;; | |
stop) | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /etc/init.d/memcached2 <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
unless(-e '/usr/share/memcached/scripts/start-memcached2') { | |
step(++$num, '/bin/cp /usr/share/memcached/scripts/start-memcached /usr/share/memcached/scripts/start-memcached2'); | |
} | |
$_ = <<'TXT'; | |
--- /usr/share/memcached/scripts/start-memcached 2010-05-12 02:41:51.000000000 -0700 | |
+++ start-memcached 2012-06-04 15:55:00.074071432 -0700 | |
@@ -15,13 +15,13 @@ | |
exit; | |
} | |
-my $params; my $etchandle; my $etcfile = "/etc/memcached.conf"; | |
+my $params; my $etchandle; my $etcfile = "/etc/memcached2.conf"; | |
# This script assumes that memcached is located at /usr/bin/memcached, and | |
# that the pidfile is writable at /var/run/memcached.pid | |
my $memcached = "/usr/bin/memcached"; | |
-my $pidfile = "/var/run/memcached.pid"; | |
+my $pidfile = "/var/run/memcached2.pid"; | |
# If we don't get a valid logfile parameter in the /etc/memcached.conf file, | |
# we'll just throw away all of our in-daemon output. We need to re-tie it so | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /usr/share/memcached/scripts/start-memcached2 <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
foreach my $rl(qw( 0 1 6 )) { | |
unless(-e sprintf("/etc/rc%d.d/S22memcached2", $rl) || -e sprintf("/etc/rc%d.d/K02memcached2", $rl)) { | |
step(++$num, sprintf("/bin/ln -s /etc/init.d/memcached2 /etc/rc%d.d/K02memcached2", $rl)); | |
} | |
} | |
foreach my $rl(qw( 2 3 4 5 )) { | |
unless(-e sprintf("/etc/rc%d.d/S22memcached2", $rl) || -e sprintf("/etc/rc%d.d/K02memcached2", $rl)) { | |
step(++$num, sprintf("/bin/ln -s /etc/init.d/memcached2 /etc/rc%d.d/S22memcached2", $rl)); | |
} | |
} | |
step(++$num, '/usr/sbin/update-rc.d memcached enable'); | |
step(++$num, '/usr/sbin/update-rc.d memcached2 enable'); | |
step(++$num, '/etc/init.d/memcached restart'); | |
step(++$num, '/etc/init.d/memcached2 restart'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Copyright 2012 Cameron King. ISC License | |
use strict; | |
use warnings; | |
# changelog | |
# 1.00 - initial version based on magento-setup.pl | |
sub block2 { | |
my $txt = shift(@_); | |
my $out = ''; | |
$out .= sprintf(" %s\n", $_) foreach(split(/\n/, $txt)); | |
return($out); | |
} | |
sub step { | |
my ($num, $cmd) = @_; | |
my $out = `$cmd`; | |
printf("---\nstep: %d\ncommand: %s\nreturn: %d\n", $num, $cmd, ${^CHILD_ERROR_NATIVE}); | |
printf("output: |2\n%s\n", block2($out)); | |
} | |
sub tmpfile { | |
my ($num, $txt) = @_; | |
my $rand_hex = join "", map { unpack "H*", chr(rand(256)) } 1..16; | |
my $fn = sprintf("/tmp/tmp.megento-optimize.%d.%s", $$, $rand_hex); | |
open(TF, ">$fn"); | |
print(TF $txt); | |
close(TF); | |
printf("---\nstep: %d\ntmpfile: %s\ncontent: |2\n%s\n", $num, $fn, block2($txt)); | |
return($fn); | |
} | |
sub rm { | |
my ($num, $fn) = @_; | |
unlink($fn); | |
printf("---\nstep: %d\nrm: %s\n\n", $num, $fn); | |
} | |
### MEMCACHED | |
die 'install memcached first' unless -e '/etc/memcached.conf'; | |
my $num=0; | |
my $tmpf=''; | |
for my $mcnum(2..9) { | |
next if -e "/etc/memcached$mcnum.conf"; | |
step(++$num, '/usr/bin/apt-get install memcached php5-memcache'); | |
unless(-e '/etc/memcached'.$mcnum.'.conf') { | |
step(++$num, '/bin/cp /etc/memcached.conf /etc/memcached'.$mcnum.'.conf'); | |
} | |
unless(-e '/etc/init.d/memcached'.$mcnum) { | |
step(++$num, '/bin/cp /etc/init.d/memcached /etc/init.d/memcached'.$mcnum); | |
} | |
unless(-e '/etc/default/memcached'.$mcnum) { | |
step(++$num, '/bin/cp /etc/default/memcached /etc/default/memcached'.$mcnum); | |
} | |
$_ = <<"TXT"; | |
--- /etc/memcached2.conf 2012-06-04 13:43:32.322150287 -0700 | |
+++ memcached.conf 2012-06-04 13:48:07.718069896 -0700 | |
\@\@ -23,7 +23,7 \@\@ | |
-m 64 | |
# Default connection port is 11211 | |
--p 11211 | |
+-p 1121$mcnum | |
# Run the daemon as root. The start-memcached will default to running as root if no | |
# -u command is present in this config file | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /etc/memcached'.$mcnum.'.conf <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
$_ = <<"TXT"; | |
--- /etc/init.d/memcached 2010-05-12 02:41:51.000000000 -0700 | |
+++ memcached2 2012-06-04 15:58:29.794071143 -0700 | |
\@\@ -1,22 +1,22 \@\@ | |
#! /bin/sh | |
### BEGIN INIT INFO | |
-# Provides: memcached | |
+# Provides: memcached$mcnum | |
# Required-Start: \$remote_fs \$syslog | |
# Required-Stop: \$remote_fs \$syslog | |
# Should-Start: \$local_fs | |
# Should-Stop: \$local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
-# Short-Description: Start memcached daemon | |
-# Description: Start up memcached, a high-performance memory caching daemon | |
+# Short-Description: Start memcached$mcnum daemon | |
+# Description: Start up memcached$mcnum, a high-performance memory caching daemon | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/bin/memcached | |
-DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached | |
-NAME=memcached | |
-DESC=memcached | |
+DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached$mcnum | |
+NAME=memcached$mcnum | |
+DESC=memcached$mcnum | |
PIDFILE=/var/run/\$NAME.pid | |
test -x \$DAEMON || exit 0 | |
@@ -37,7 +37,7 @@ | |
start-stop-daemon --start --quiet --exec \$DAEMONBOOTSTRAP | |
echo "\$NAME." | |
else | |
- echo "\$NAME disabled in /etc/default/memcached." | |
+ echo "\$NAME disabled in /etc/default/memcached$mcnum." | |
fi | |
;; | |
stop) | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /etc/init.d/memcached'.$mcnum.' <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
unless(-e '/usr/share/memcached/scripts/start-memcached'.$mcnum) { | |
step(++$num, '/bin/cp /usr/share/memcached/scripts/start-memcached /usr/share/memcached/scripts/start-memcached'.$mcnum); | |
} | |
$_ = <<"TXT"; | |
--- /usr/share/memcached/scripts/start-memcached 2010-05-12 02:41:51.000000000 -0700 | |
+++ start-memcached 2012-06-04 15:55:00.074071432 -0700 | |
@@ -15,13 +15,13 @@ | |
exit; | |
} | |
-my \$params; my \$etchandle; my \$etcfile = "/etc/memcached.conf"; | |
+my \$params; my \$etchandle; my \$etcfile = "/etc/memcached$mcnum.conf"; | |
# This script assumes that memcached is located at /usr/bin/memcached, and | |
# that the pidfile is writable at /var/run/memcached.pid | |
my \$memcached = "/usr/bin/memcached"; | |
-my \$pidfile = "/var/run/memcached.pid"; | |
+my \$pidfile = "/var/run/memcached$mcnum.pid"; | |
# If we don't get a valid logfile parameter in the /etc/memcached.conf file, | |
# we'll just throw away all of our in-daemon output. We need to re-tie it so | |
TXT | |
$tmpf = tmpfile(++$num, $_); | |
step(++$num, sprintf('/usr/bin/patch /usr/share/memcached/scripts/start-memcached'.$mcnum.' <%s', $tmpf)); | |
rm(++$num, $tmpf); | |
foreach my $rl(qw( 0 1 6 )) { | |
unless(-e sprintf("/etc/rc%d.d/S22memcached$mcnum", $rl) || -e sprintf("/etc/rc%d.d/K02memcached$mcnum", $rl)) { | |
step(++$num, sprintf("/bin/ln -s /etc/init.d/memcached$mcnum /etc/rc%d.d/K02memcached$mcnum", $rl)); | |
} | |
} | |
foreach my $rl(qw( 2 3 4 5 )) { | |
unless(-e sprintf("/etc/rc%d.d/S22memcached$mcnum", $rl) || -e sprintf("/etc/rc%d.d/K02memcached$mcnum", $rl)) { | |
step(++$num, sprintf("/bin/ln -s /etc/init.d/memcached$mcnum /etc/rc%d.d/S22memcached$mcnum", $rl)); | |
} | |
} | |
step(++$num, '/usr/sbin/update-rc.d memcached'.$mcnum.' enable'); | |
step(++$num, '/etc/init.d/memcached'.$mcnum.' restart'); | |
last; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment