| 1 | #!/sbin/openrc-run |
| 2 | description="Initialize Lapis Server" |
| 3 | lver=5.2 |
| 4 | command="/usr/bin/lapis$lver" |
| 5 | command_args="server production" |
| 6 | pidfile="/var/run/nginx/nginx.pid" |
| 7 | lapis_path=/usr/share/lapis |
| 8 | |
| 9 | depend() { |
| 10 | need net |
| 11 | } |
| 12 | |
| 13 | start_pre() { |
| 14 | checkpath --directory --owner nginx:nginx ${pidfile%/*} |
| 15 | } |
| 16 | |
| 17 | start() { |
| 18 | ebegin "Starting Lapis" |
| 19 | start-stop-daemon --start \ |
| 20 | --chdir ${lapis_path} \ |
| 21 | --exec ${command} ${command_args} \ |
| 22 | -b --make-pidfile \ |
| 23 | --pidfile "${pidfile}" |
| 24 | eend $? |
| 25 | } |
| 26 | |
| 27 | stop() { |
| 28 | ebegin "Stopping Lapis" |
| 29 | start-stop-daemon --stop \ |
| 30 | --exec ${command} \ |
| 31 | --pidfile "${pidfile}" |
| 32 | eend $? |
| 33 | } |