31 lines
		
	
	
		
			863 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			863 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#!/sbin/openrc-run
 | 
						|
 | 
						|
description="Ollama Embedded AI Service"
 | 
						|
command="/usr/bin/ollama"
 | 
						|
command_args="serve"
 | 
						|
command_user="ollama"
 | 
						|
command_group="ollama"
 | 
						|
command_background="yes"
 | 
						|
pidfile="/run/ollama.pid"
 | 
						|
log="/var/log/ollama/ollama.log"
 | 
						|
 | 
						|
# Ollama allows cross-origin requests from 127.0.0.1 and 0.0.0.0 by default.
 | 
						|
# Additional origins can be configured with OLLAMA_ORIGINS.
 | 
						|
# export OLLAMA_ORIGINS="<ip>"
 | 
						|
 | 
						|
start() {
 | 
						|
	ebegin "Starting $description"
 | 
						|
	exec >> >(logger -t "$RC_SVCNAME Start daemon" -p daemon.info)
 | 
						|
	start-stop-daemon --start --background --user "$command_user" --group "$command_group" \
 | 
						|
			--pidfile "$pidfile" --make-pidfile --exec $command $command_args -1 $log -2 $log
 | 
						|
	eend $?
 | 
						|
}
 | 
						|
 | 
						|
stop() {
 | 
						|
	ebegin "Stopping $description"
 | 
						|
	exec >> >(logger -t "$RC_SVCNAME Stop daemon" -p daemon.info)
 | 
						|
	start-stop-daemon --stop --pidfile "$pidfile"
 | 
						|
	eend $?
 | 
						|
}
 | 
						|
 |