@@ -60,45 +60,46 @@ intro() {
6060 echo
6161 echo " Setup and upgrade:"
6262 echo
63- echo " ${BOLD} setup${NORMAL} setup new Misago site."
64- echo " ${BOLD} upgrade${NORMAL} backup , rebuild, migrate and collect static."
63+ echo " ${BOLD} setup${NORMAL} Setup new Misago site."
64+ echo " ${BOLD} upgrade${NORMAL} Backup , rebuild, migrate and collect static."
6565 echo
6666 echo " Docker management:"
6767 echo
68- echo " ${BOLD} start${NORMAL} start all containers."
69- echo " ${BOLD} stop${NORMAL} stop all containers."
70- echo " ${BOLD} restart${NORMAL} stop and start all docker containers."
71- echo " ${BOLD} rebuild${NORMAL} rebuild and restart Misago and celery container containers."
72- echo " ${BOLD} rebuildall${NORMAL} pull , rebuild and restart all containers."
73- echo " ${BOLD} stats${NORMAL} see list and stats of running docker containers."
68+ echo " ${BOLD} start${NORMAL} Start all containers."
69+ echo " ${BOLD} stop${NORMAL} Stop all containers."
70+ echo " ${BOLD} restart${NORMAL} Stop and start all docker containers."
71+ echo " ${BOLD} rebuild${NORMAL} Rebuild and restart Misago and celery container containers."
72+ echo " ${BOLD} rebuildall${NORMAL} Pull , rebuild and restart all containers."
73+ echo " ${BOLD} stats${NORMAL} See list and stats of running docker containers."
7474 echo
7575 echo " Change configuration:"
7676 echo
77- echo " ${BOLD} forumindex${NORMAL} switch forum index between threads and categories."
78- echo " ${BOLD} email${NORMAL} change email setup."
79- echo " ${BOLD} hostname${NORMAL} change hostname setup."
80- echo " ${BOLD} locale${NORMAL} change locale setup."
81- echo " ${BOLD} timezone${NORMAL} change timezone setup."
82- echo " ${BOLD} avatargallery${NORMAL} load avatar gallery."
83- echo " ${BOLD} sentry${NORMAL} enable or disable Sentry (sentry.io) for logging."
84- echo " ${BOLD} debug${NORMAL} change debug mode."
85- echo " ${BOLD} secret${NORMAL} reset secret key."
77+ echo " ${BOLD} forumindex${NORMAL} Switch forum index between threads and categories."
78+ echo " ${BOLD} email${NORMAL} Change email setup."
79+ echo " ${BOLD} hostname${NORMAL} Change hostname setup."
80+ echo " ${BOLD} locale${NORMAL} Change locale setup."
81+ echo " ${BOLD} timezone${NORMAL} Change timezone setup."
82+ echo " ${BOLD} avatargallery${NORMAL} Load avatar gallery."
83+ echo " ${BOLD} sentry${NORMAL} Enable or disable Sentry (sentry.io) for logging."
84+ echo " ${BOLD} debug${NORMAL} Change debug mode."
85+ echo " ${BOLD} secret${NORMAL} Reset secret key."
8686 echo
8787 echo " Note: you need to rebuild Misago container for changes made with those utils to take effect."
8888 echo
8989 echo " Backup:"
9090 echo
91- echo " ${BOLD} backup${NORMAL} backup and archive database and media."
92- echo " ${BOLD} restore BACKUP${NORMAL} restore database and media from BACKUP archive."
91+ echo " ${BOLD} backup${NORMAL} Backup and archive database and media."
92+ echo " ${BOLD} restore BACKUP${NORMAL} Restore database and media from BACKUP archive."
9393 echo
9494 echo " Utilities:"
9595 echo
96- echo " ${BOLD} collectstatic${NORMAL} collect static assets."
97- echo " ${BOLD} manage.py${NORMAL} runs \" python manage.py\" inside docker."
98- echo " ${BOLD} bash${NORMAL} starts bash session inside running Misago container."
99- echo " ${BOLD} run${NORMAL} runs \" docker-compose run --rm misago\" ."
100- echo " ${BOLD} psql${NORMAL} runs psql connected to database."
101- echo " ${BOLD} flushredis${NORMAL} flush the redis cache."
96+ echo " ${BOLD} collectstatic${NORMAL} Collect static assets."
97+ echo " ${BOLD} manage.py${NORMAL} Runs \" python manage.py\" inside docker."
98+ echo " ${BOLD} bash${NORMAL} Starts bash session inside running Misago container."
99+ echo " ${BOLD} run${NORMAL} Runs \" docker-compose run --rm misago\" ."
100+ echo " ${BOLD} psql${NORMAL} Runs psql connected to database."
101+ echo " ${BOLD} flushredis${NORMAL} Flush the redis cache."
102+ echo " ${BOLD} resetcron${NORMAL} Replace host's crontab with default one."
102103 echo
103104}
104105
@@ -159,7 +160,7 @@ set_crontab() {
159160 rm -f cron_tmp
160161 touch cron_tmp
161162 echo " 30 1 * * * cd $current_path && $docker_compose run --rm misago ./cron" >> cron_tmp
162- echo " 0 1 * * * cd $current_path && ./appctl daily_backup " >> cron_tmp
163+ echo " 0 1 * * * cd $current_path && $docker_compose run --rm misago ./.run backup \" auto- \$ (date +%Y%m%d%H%M%S) \" " >> cron_tmp
163164 echo " 0 1 * * * find $current_path /backups/ -name auto-* -type f -mtime +10 -delete" >> cron_tmp
164165 echo " " >> cron_tmp
165166 crontab cron_tmp
@@ -320,30 +321,8 @@ reset_secret_key() {
320321# Create new backup
321322create_new_backup () {
322323 require_setup
323- if [[ $1 ]]; then
324- backup_type=" $1 "
325- else
326- backup_type=" manual"
327- fi
328- # create tmp backup dir
329- backup_dir=" $backup_type -$( date +%Y%m%d%H%M%S) "
330- mkdir " ./backups/$backup_dir "
331- # backup database
332- echo " Backing up database..."
333- $docker_compose run --rm misago ./.run backup_db $backup_dir
334- # backup media
335- echo " Backing up media..."
336- cp -r ./misago/media " ./backups/$backup_dir /media"
337- cd ./backups/
338- # archive backup dir
339- backup_archive=" $backup_type -$( date +%Y%m%d%H%M%S) .tar.gz"
340- GZIP=-9
341- tar -zcf $backup_archive " $backup_dir "
342- # delete backup dir as its no longer required
343- rm -rf $backup_dir
344- cd ..
345- echo " New backup has been created at backups/$backup_archive "
346- echo
324+ backup_name=" manual-$( date +%Y%m%d%H%M%S) "
325+ $docker_compose run --rm misago ./.run backup $backup_name
347326}
348327
349328# Restore from backup
@@ -472,6 +451,8 @@ if [[ $1 ]]; then
472451 docker_run $@
473452 elif [[ $1 = " psql" ]]; then
474453 run_psql
454+ elif [[ $1 = " resetcron" ]]; then
455+ set_crontab
475456 else
476457 invalid_argument $1
477458 fi
0 commit comments