47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#!/sbin/openrc-run
 | 
						|
 | 
						|
name=$RC_SVCNAME
 | 
						|
description="OpenNebula management"
 | 
						|
command="/usr/bin/oned"
 | 
						|
command_args="-f"
 | 
						|
command_user="oneadmin:cloud"
 | 
						|
pidfile="/run/one/${RC_SVCNAME}.pid"
 | 
						|
supervisor="supervise-daemon"
 | 
						|
 | 
						|
depend() {
 | 
						|
        need mariadb
 | 
						|
        after syslog networking localmount netmount
 | 
						|
        want opennebula-scheduler opennebula-hem opennebula-ssh-agent
 | 
						|
}
 | 
						|
 | 
						|
start_pre() {
 | 
						|
        /bin/mkdir -p /var/log/one
 | 
						|
        /bin/mkdir -p /var/lock/one
 | 
						|
        /bin/mkdir -p /run/one
 | 
						|
        /bin/chown $command_user -R /var/log/one /run/one /var/lock/one
 | 
						|
        /usr/sbin/logrotate -s /tmp/logrotate.state -f /etc/logrotate.d/opennebula.logrotate
 | 
						|
}
 | 
						|
 | 
						|
start() {
 | 
						|
        ebegin "Starting $RC_SVCNAME"
 | 
						|
        start-stop-daemon --background \
 | 
						|
            --exec $command \
 | 
						|
            --make-pidfile --pidfile $pidfile --user $command_user \
 | 
						|
            --start -- $command_args
 | 
						|
        eend $?
 | 
						|
}
 | 
						|
 | 
						|
stop() {
 | 
						|
        ebegin "Stopping $RC_SVCNAME"
 | 
						|
        start-stop-daemon --stop \
 | 
						|
            --retry TERM/10/KILL/10 \
 | 
						|
            --exec $command \
 | 
						|
            --pidfile $pidfile --user $command_user
 | 
						|
        eend $?
 | 
						|
}
 | 
						|
 | 
						|
stop_post() {
 | 
						|
        /bin/rm -f /var/lock/one/one
 | 
						|
        /usr/share/one/follower_cleanup
 | 
						|
}
 |