26 lines
		
	
	
		
			519 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			519 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
touch /state/.starting
 | 
						|
echo "mastodon-startup starting up..."
 | 
						|
 | 
						|
if [[ ! -d /state/envdir ]]; then
 | 
						|
    mkdir -p /state/envdir
 | 
						|
    chown mastodon:mastodon /state/envdir
 | 
						|
fi
 | 
						|
 | 
						|
if [[ ! -e /state/envdir/HOME ]]; then
 | 
						|
    echo "/mastodon" > /state/envdir/HOME
 | 
						|
fi
 | 
						|
 | 
						|
cd /mastodon/app
 | 
						|
 | 
						|
if [ "$RUN_DB_MIGRATIONS" == "true" ]; then
 | 
						|
  echo "Running database migrations..."
 | 
						|
  envdir /state/envdir chpst -u mastodon:mastodon bash -c "bundle exec rake db:migrate"
 | 
						|
fi
 | 
						|
 | 
						|
rm /state/.starting
 | 
						|
while true ; do
 | 
						|
    sleep 86400
 | 
						|
done
 |