24 lines
		
	
	
		
			779 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			779 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								# sudo rsync -av etc/init/caddy.conf /etc/init/caddy.conf
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								description "Caddy Server"
							 | 
						||
| 
								 | 
							
								version "1.0"
							 | 
						||
| 
								 | 
							
								author "AJ ONeal"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Upstart has nothing in $PATH by default
							 | 
						||
| 
								 | 
							
								env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Keep the server running on crash or machine reboot
							 | 
						||
| 
								 | 
							
								respawn
							 | 
						||
| 
								 | 
							
								respawn limit 10 120
							 | 
						||
| 
								 | 
							
								start on runlevel [2345]
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Start the server using spark and redirect output to log files
							 | 
						||
| 
								 | 
							
								script
							 | 
						||
| 
								 | 
							
								  DATE=`date '+%F_%H-%M-%S'`
							 | 
						||
| 
								 | 
							
								  cd /srv/walnut
							 | 
						||
| 
								 | 
							
								  # exec /usr/local/bin/caddy -conf /srv/walnut/Caddyfile -pidfile /tmp/caddy.pid \
							 | 
						||
| 
								 | 
							
								  exec start-stop-daemon --start --pidfile /tmp/caddy.pid --exec /usr/local/bin/caddy -- -conf /srv/walnut/Caddyfile --pidfile /tmp/caddy.pid \
							 | 
						||
| 
								 | 
							
								    > "./logs/access.caddy.${DATE}.log" \
							 | 
						||
| 
								 | 
							
								    2> "./logs/error.caddy.${DATE}.log" 
							 | 
						||
| 
								 | 
							
								end script
							 |