Sysadmin grodoudou admin scripts 30 07 2012 - Seizam/seizamcore GitHub Wiki

Session

  • user : root
  • host : grodoudou.seizam.com
  • date : 30/07/12 08:57
  • curpath : /root

Commands

 [email protected]# cd /root
 [email protected]# git clone git://gist.github.com/3180925.git admin-scripts
 [email protected]# cd admin-scripts/
 [email protected]# cp /root/admin-scripts/server.cfg.sample /root/admin-scripts/server.cfg
  • Edit /root/admin-scripts/server.cfg, see [1]
 [email protected]# cd /mnt/backups/
 [email protected]# mkdir old
 [email protected]# mv 2012* old/
 [email protected]# mkdir weekly
 [email protected]# mkdir daily
 [email protected]# chmod 700 *
 [email protected]# mv /var/log/wikizam-cron/wikizam-cron.old /var/log/wikizam-cron/wikizam-cron.old.log
 [email protected]# cd /var/log/wikizam-cron
 [email protected]# mkdir incremental-history
 [email protected]# chmod -R 700 /var/log/wikizam-cron/
 [email protected]# mv updateUsages.php-20120730-report.log /root/updateUsages.php-20120730-report.log
 [email protected]# tar -czvf archive-20120730.tar.gz *.log
 [email protected]# chmod 500 archive-20120730.tar.gz
 [email protected]# rm *.log
 [email protected]# mv /root/updateUsages.php-20120730-report.log updateUsages.php-20120730-report.log
  • On FTP server, create 'daily' and 'weekly' directories
 [email protected]# ftp
  • Edit /etc/crontab, see [2]
 [email protected]# /etc/init.d/cron reload

Files

  • [1] Edit /root/admin-scripts/server.cfg
--- old	2012-07-30 09:15:50.000000000 +0000
+++ new	2012-07-30 09:39:41.000000000 +0000
@@ -4,8 +4,8 @@
 # Where to store backup locally
-backupDir='/tmp/backups'; # absolute path, without final slash
+backupDir='/mnt/backups'; # absolute path, without final slash
 
 # Where to store backup remotely
-ftpHost='localhost'
-ftpUser='user'
-ftpUserPassword='password'
+ftpHost='the_ftp_host'
+ftpUser='the_ftp_username'
+ftpUserPassword='the_ftp_password'
 ftpSpaceUsageFile='/.banner'; # whille be downloaded and stored in report dir
@@ -13,6 +13,6 @@
 # Which databases to backup
-databasesToBackup='first second third';
+databasesToBackup='wikidb';
 
 # Which directories to backup
-directoriesToBackup='/tmp/first /tmp/second /tmp/third';
+directoriesToBackup='/var/szfiles /var/public-files';
 
@@ -23,3 +23,3 @@
 dailyBackupLifetime=15; # number of days ; over this age, daily backups are removed
-incrementalHistoryDir="/tmp/ih";
+incrementalHistoryDir="/var/log/wikizam-cron/incremental-history";
 
@@ -30,6 +30,6 @@
 # Reports configuration
-ftpLogDir='/tmp';
-reportsDir='/tmp';
+ftpLogDir='/var/log/wikizam-cron';
+reportsDir='/var/log/wikizam-cron';
 reportEmailAddress='root';
-reportSubject="[Report] "`hostname`;
+reportSubject="[Report] Grodoudou";
 
@@ -37,4 +37,4 @@
 # configuration for wikizamUpdater
-gitFolder="/tmp/git/seizamcore"; # absolute path, without final slash
-wikizamFolder="/tmp/wikizam"; # absolute path, without final slash
+gitFolder="/root/seizam-git/seizamcore"; # absolute path, without final slash
+wikizamFolder="/var/wikizam"; # absolute path, without final slash
 apacheStopOption="graceful-stop"; # this stop option can differ depending of apache version
  • [2] Edit /etc/crontab
--- old	2012-07-30 09:41:25.000000000 +0000
+++ new	2012-07-30 09:42:54.000000000 +0000
@@ -17,12 +17,12 @@
 # each day at 15.00 fr
-0 13	* * *	root	/root/exec-php-send-report.sh "extensions/Wikiplaces/updateSubscriptions.php" /var/wikizam/deployed
+0 13	* * *	root	/root/admin-scripts/exec-php-live-report.sh "extensions/Wikiplaces/updateSubscriptions.php" /var/wikizam/deployed
 
 # each day at 14.00 fr
-0 12	* * *	root	/root/exec-php-send-report.sh "extensions/Wikiplaces/checkNextRenewals.php --deadline=7" /var/wikizam/deployed
+0 12	* * *	root	/root/admin-scripts/exec-php-live-report.sh "extensions/Wikiplaces/checkNextRenewals.php --deadline=7" /var/wikizam/deployed
 
-# each 5 minutes
+# each hour, at 30th minute
-*/5 *	* * *	root	/root/exec-php-send-daily-report.sh "extensions/Wikiplaces/updateUsages.php --lifespan=60" /var/wikizam/deployed
+30 *	* * *	root	/root/admin-scripts/exec-php-daily-report.sh "extensions/Wikiplaces/updateUsages.php --lifespan=1440" /var/wikizam/deployed
 
 # each day at 13.00 fr
-0 11	* * *	root	/root/mysql-daily-backup.sh
+0 11	* * *	root	/root/admin-scripts/backup.sh
 
⚠️ **GitHub.com Fallback** ⚠️