Рестартер:
Код:
!/usr/bin/perl -w
$procnum = `/bin/ps af | /usr/bin/grep [/]usr/home/mangosd/ | /usr/bin/wc -l`;
if ($procnum == 2) {
print "Everything seems to be okay\n";
} else {
system("killall mangos-realmd");
system("killall mangos-worldd");
print `cp /usr/home/mangosd/log/worldd.log /usr/home/mangosd/log/worldd.log.prev`;
while ($procnum != 0) {
sleep(1);
$procnum = `/bin/ps af | /usr/bin/grep [/]usr/home/mangosd/ | /usr/bin/wc -l`;
}
print `/usr/local/bin/screen -dmS mangos_worldd /usr/home/mangosd/bin/mangos-worldd`;
sleep(3);
print `/usr/local/bin/screen -dmSU mangos_realmd /usr/home/mangosd/bin/mangos-realmd`;
}
Скрипт для создание резервных копий.(каждый день в 4 часа ночи)
Код:
#!/bin/sh
today=$(/bin/date "+%Y%m%d")
rmday=$(/bin/date -v-10d "+%Y%m%d")
/usr/local/bin/mysqldump -pmangos mangos > /usr/home/mangosd/backup/mangos/$today.sql
/bin/rm /usr/home/mangosd/backup/mangos/$rmday.sql
/usr/local/bin/mysqldump -pmangos characters > /usr/home/mangosd/backup/characters/$today.sql
/bin/rm /usr/home/mangosd/backup/characters/$rmday.sql
/usr/local/bin/mysqldump -pmangos realmd > /usr/home/mangosd/backup/realmd/$today.sql
/bin/rm /usr/home/mangosd/backup/realmd/$rmday.sql
/usr/local/bin/mysqldump -pmangos scriptdev2 > /usr/home/mangosd/backup/scriptdev2/$today.sql
/bin/rm /usr/home/mangosd/backup/scriptdev2/$rmday.sql
Может что-нибудь пригодиться.