Make helper more posix compliant
This commit is contained in:
		
							
								
								
									
										10
									
								
								morss-helper
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										10
									
								
								morss-helper
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							@@ -3,15 +3,15 @@ if ! command -v python && command -v python3 ; then
 | 
				
			|||||||
	alias python='python3'
 | 
						alias python='python3'
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function run {
 | 
					run() {
 | 
				
			||||||
	gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - morss
 | 
						gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - morss
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function daemon {
 | 
					daemon() {
 | 
				
			||||||
	gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - --daemon morss
 | 
						gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - --daemon morss
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function reload {
 | 
					reload() {
 | 
				
			||||||
	pid=$(pidof 'gunicorn: master [morss]') # NB. requires python-setproctitle
 | 
						pid=$(pidof 'gunicorn: master [morss]') # NB. requires python-setproctitle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "$pid" ]; then
 | 
						if [ -z "$pid" ]; then
 | 
				
			||||||
@@ -27,11 +27,11 @@ function reload {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function check {
 | 
					check() {
 | 
				
			||||||
	python -m morss.crawler http://localhost:${PORT:-8000}/ > /dev/null 2>&1
 | 
						python -m morss.crawler http://localhost:${PORT:-8000}/ > /dev/null 2>&1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$1" = "sh" ] || [ "$1" = "bash" ] || [ "$(type -t "$1")" = "function" ]; then
 | 
					if [ "$1" = "sh" ] || [ "$1" = "bash" ] || command -v "$1" ; then
 | 
				
			||||||
	$@
 | 
						$@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user