sinatra app
#acc-server.rb
require 'sinatra/base'
class MyApp < Sinatra::Base
set :bind, '0.0.0.0'
set :port, 3333
get '/' do
"Hello #{params[:name]}"
end
run! if app_file == $0
end
rackup
require './acc-server'
run MyApp
shell script server.sh
#!/bin/bash
cd /root/server && /usr/local/bin/rackup -p 3333 -P /root/server/server.pid </dev/null &>>/root/server/log
systemd conf /etc/systemd/system/pserver.service
[Unit]
Description=Prosody http server
[Service]
ExecStart=/root/server/server.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
start the service
systemctl start pserver.service
then enable it on startup
systemctl enable pserver.service
Top comments (0)