forked from kamba4/sunders
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			No EOL
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			No EOL
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/bin/sh
 | 
						|
set -e
 | 
						|
 | 
						|
 | 
						|
####################################################################################################
 | 
						|
### Crontab settings
 | 
						|
####################################################################################################
 | 
						|
 | 
						|
cat<<EOF | dcrontab -
 | 
						|
# min     hour      day     month     weekday command
 | 
						|
*/15   *   *       *         *       sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1
 | 
						|
EOF
 | 
						|
 | 
						|
####################################################################################################
 | 
						|
### Run prescripts
 | 
						|
####################################################################################################
 | 
						|
 | 
						|
php /opt/init_db.php
 | 
						|
#TODO add db_migrations
 | 
						|
echo "Prescripts done"
 | 
						|
 | 
						|
####################################################################################################
 | 
						|
### Run script once immediately
 | 
						|
####################################################################################################
 | 
						|
 | 
						|
echo "Running update once initially..."
 | 
						|
sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1
 | 
						|
echo "Initial update done"
 | 
						|
 | 
						|
####################################################################################################
 | 
						|
### Run cron to schedule periodic task
 | 
						|
####################################################################################################
 | 
						|
 | 
						|
# see: https://github.com/dubiousjim/dcron/issues/13
 | 
						|
# ignore using `exec` for `dcron` to get another pid instead of `1`
 | 
						|
# exec "$@"
 | 
						|
"$@" |