Commit dbf89b44 authored by Yuanle Song's avatar Yuanle Song
Browse files

v1.3.0 add systemd service file support

parent 4181bea0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "1.2.0"
(defproject python/lein-template "1.3.0"
  :description "lein template for a python project"
  :repositories [["snapshots"
                  {:url "http://devserv.game.yy.com/nexus/content/repositories/snapshots"
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@
                        "conf/uwsgi.ini"
                        "conf/uwsgi.upstart"
                        "conf/web.upstart"
                        "conf/web.service"
                        "git-hooks/post-commit"
                        "git-hooks/post-merge"
                        "git-hooks/pre-commit"
+16 −0
Original line number Diff line number Diff line
[Unit]
Description=TODO add description here

[Service]
Type=simple
LimitNOFILE=65535
Environment="LANG=en_US.UTF-8"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="PORT=8082"
User=www-data
Group=www-data
ExecStart=/usr/bin/make run -C /opt/{{name}}
Restart=always

[Install]
WantedBy=multi-user.target
+3 −2
Original line number Diff line number Diff line
@@ -15,14 +15,15 @@ cd "$PREFIX"
make bootstrap
# make install

# install crontab, upstart job, nginx site file, logrotate config etc
# install crontab, systemd service, nginx site file, logrotate config etc

# if you enable logrotate.conf, remember to choose a good rotate interval and
# set how many copies to keep.

# install "$PREFIX/conf/logrotate.conf" /etc/logrotate.d/{{name}}
# install "$PREFIX/conf/web.upstart" /etc/init/{{name}}.conf
# start {{name}} || true
# install "$PREFIX/conf/web.service" /etc/systemd/system/{{name}}.service
# service {{name}} start || true

# SITE_FILE=/etc/nginx/conf.d/{{name}}.conf
# if [ -e "$SITE_FILE" ]; then
+9 −1
Original line number Diff line number Diff line
@@ -9,6 +9,14 @@ stop_upstart_service_maybe() {
		fi
	fi
}
stop_systemd_service_maybe() {
	service="$1"
	if [ -e /etc/systemd/system/${service}.service ]; then
		if systemctl -q is-active "$service"; then
			systemctl stop "$service" || true
		fi
	fi
}

cd /
# stop_upstart_service_maybe {{name}}
# stop_systemd_service_maybe {{name}}
Loading