I got my old server upgraded (reinstalled rather) from CentOS 6.x to CentOS 7. On this server I had this EyeFi server running
https://code.google.com/p/eyefiserver/ . It handles uploads from my EyeFi-card in my camera. On my old server I started this program with the included start script.
Code:
#!/bin/sh
#
# $Id$
#
# eyefiserver initscript for eyefiserver.py
# This file should be placed in /etc/init.d.
#
# Original Author: Mattias Holmlund
#
# Updated By: Dan Sully, pike
#
### BEGIN INIT INFO
# Provides: eyefiserver
# Required-Start: $all
# Required-Stop: $all
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Startup script for the EyeFiServer
# Description: EyeFiServer sits on port xxxx waiting for soap requests from
# an EyeFi SD card; see http://www.eye.fi
### END INIT INFO
#
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="EyeFiServer"
NAME=eyefiserver
DAEMON=/usr/local/bin/${NAME}.py
CFGFILE=/etc/$NAME.conf
LOGFILE=/var/log/$NAME.log
EYEFIUSER=www-data
EYEFIGROUP=www-data
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
#
# Function that starts the daemon/service.
#
d_start() {
touch $LOGFILE
chown $EYEFIUSER:$EYEFIGROUP $LOGFILE
start-stop-daemon --start \
--chuid $EYEFIUSER:$EYEFIGROUP \
--pidfile $PIDFILE \
--startas $DAEMON \
--background \
--make-pidfile \
-- $CFGFILE $LOGFILE
}
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --oknodo --pidfile $PIDFILE
rm -rf $PIDFILE
}
#
# Function that sends a SIGHUP to the daemon/service.
#
d_reload() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--name $NAME.py --signal 1
}
case "$1" in
start)
echo -n "Starting $DESC"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC"
d_stop
echo "."
;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
echo -n "Restarting $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
# echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
But since CentOS 7 moved to Systemd that wont work any more. I need help to create a systemd start-script that "daemonizes"
the eyefiserver program.
I tried to copy another start-script, but, as I'm sure what goes on, I can't really get it working.
Code:
[Unit]
Description=EyeFi Server
[Service]
Type=simple
User=www-data
Group=www-data
PIDFile=/var/run/eyefiserver.pid
ExecStart=/usr/local/bin/eyefiserver.py /etc/eyefiserver.conf /var/log/eyefiserver.log
[Install]
WantedBy=multi-user.target
Can anybody give me some help or pointers?