|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #!/bin/bash
-
-
- if ! [ -w $PLANNING_ROOT ];
- then
- echo "Planning root directory: $PLANNING_ROOT doesn't exist, or isn't writable by this user";
- exit 1
- fi;
-
-
- if ! [ -w $PLANNING_BACKUPS ];
- then
- echo "Planning backups directory: $PLANNING_BACKUPS doesn't exist, or isn't writable";
- exit 2
- fi;
-
-
-
- if [ ! -w $DEPLOYMENT_LOG -a ! -w $DEPLOYMENT_LOG_DIRECTORY ];
- then
- echo "Deployment log: $DEPLOYMENT_LOG doesn't exist, or isn't writable";
- exit 3
- fi;
-
-
- mkdir $BACKUP_DIRECTORY
-
-
-
-
- echo
- echo "Backing up the current deployment to $BACKUP_DIRECTORY"
- (cd $PLANNING_ROOT;
- mv docs cgi-bin tools $BACKUP_DIRECTORY;
- cp -R data $BACKUP_DIRECTORY;
- );
- echo "Done"
- echo
-
- echo "Generating python scrapers"
-
- (cd python_scrapers; ./generateCGIScripts.py)
- echo "Done generating python scrapers"
-
-
- echo "Deploying the new versions of docs, cgi-bin, and tools"
- cp -R docs cgi-bin tools $PLANNING_ROOT
-
-
-
-
- if [ -a $BACKUP_DIRECTORY/docs/include/config.php ];
- then
- echo "Copying back config.php";
- cp $BACKUP_DIRECTORY/docs/include/config.php $PLANNING_ROOT/docs/include/;
- else
- echo "No config.php to put back";
- fi;
-
-
- if [ -a $BACKUP_DIRECTORY/docs/.htaccess ];
- then
- echo "Copying back .htaccess";
- cp $BACKUP_DIRECTORY/docs/.htaccess $PLANNING_ROOT/docs/;
-
- else
- echo "No .htaccess to put back";
- fi;
-
- echo "Enter a reason for deployment:"
- read REASON
- echo
- echo $REASON
-
-
- echo
- echo "Updating deployment log"
- echo -e "Deployed by $USER on `date`\nReason: $REASON" >> $DEPLOYMENT_LOG
- echo
-
-
- echo "emailing the team"
- echo -e "www.planningalerts.com redeployed by $USER on `date`\nReason: $REASON" | mail -s "PlanningAlerts Deployment" $TEAM_EMAIL
-
- echo
- echo "Remember to check that there are no changes needed in:"
- echo ".htaccess"
- echo "docs/include/config.php"
- echo
|