Who can share start/stop script for SysVinit: /etc/init.d/radicale #1685
Replies: 6 comments
-
I'm using this: [Unit]
Description=A simple CalDAV (calendar) and CardDAV (contact) server
After=network.target
Requires=network.target
[Service]
ExecStart=/usr/bin/env python3 -m radicale
Restart=on-failure
User=radicale
# Deny other users access to the calendar data
UMask=0027
# Optional security settings
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
NoNewPrivileges=true
ReadWritePaths=/var/lib/radicale/collections
[Install]
WantedBy=multi-user.target |
Beta Was this translation helpful? Give feedback.
-
@frasten This is a systemd service file, Alpine Linux doesn’t have systemd… As OpenRC is used by many non-SystemD distros, including Alpine I’ll take that you’d probably prefer OpenRC instead of actual SysVinit. (as they often end up with ~200 lines) And I’m using this script for radicale 2.x.x #!/sbin/openrc-run
#command="/srv/radicale/Radicale/radicale.py"
command="python"
command_args="-m radicale"
command_user="radicale"
command_background="yes"
pidfile="/var/run/radicale.pid"
description="A Free and Open-Source CalDAV and CardDAV Server"
depend() {
need localmount
need net
} |
Beta Was this translation helpful? Give feedback.
-
Hi there,
on Ubuntu16.04 LTS this leads during boot time to
[ 4.813488] systemd[1]: [/etc/systemd/system/radicale.service:14]
Failed to parse protect system value, ignoring: strict
[ 4.813621] systemd[1]: [/etc/systemd/system/radicale.service:17]
Unknown lvalue 'ProtectKernelTunables' in section 'Service'
[ 4.813751] systemd[1]: [/etc/systemd/system/radicale.service:18]
Unknown lvalue 'ProtectKernelModules' in section 'Service'
[ 4.813880] systemd[1]: [/etc/systemd/system/radicale.service:19]
Unknown lvalue 'ProtectControlGroups' in section 'Service'
[ 4.814009] systemd[1]: [/etc/systemd/system/radicale.service:21]
Unknown lvalue 'ReadWritePaths' in section 'Service'
Apparently, it has no impact during runtime.
Cu
Mirko
Am 21.12.2017 um 18:10 schrieb Andrea Piccinelli:
…
I'm using this:
[Unit]
Description=A simpleCalDAV (calendar) andCardDAV (contact) server
After=network.target
Requires=network.target
[Service]
ExecStart=/usr/bin/env python3-m radicale
Restart=on-failure
User=radicale
# Deny other users access to the calendar data
UMask=0027
# Optional security settings
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
NoNewPrivileges=true
ReadWritePaths=/var/lib/radicale/collections
[Install]
WantedBy=multi-user.target
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#737 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AVKXXJQ2CWZfeU098P_vupUPycmLULbTks5tCpD6gaJpZM4QNacI>.
|
Beta Was this translation helpful? Give feedback.
-
This is my imperfect script at
Invoke like: |
Beta Was this translation helpful? Give feedback.
-
Hi @dr0i , Thanks for posting this. Yours worked for me in a pinch. |
Beta Was this translation helpful? Give feedback.
-
My Radicale is running Gunicorn, and the above script wasn't working properly because I'm on a Raspberry, and the main cause of the crash is that the usb raid it's running on is somehow being unmounted. #! /bin/sh
### BEGIN INIT INFO
# Provides: radicale
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Provides webDav calendar
# Description: Provides radicale, a webDav server implementation
### END INIT INFO
N=/etc/init.d/radicale
set -e
case "$1" in
start)
# Prüfen, ob die Platte richtig eingehängt ist
if mountpoint -q /raid; then
# Radicale starten
echo "started radicale"
su - radicale -c "
cd /raid/home/radicale &&
source virtual/bin/activate &&
gunicorn -D --bind '192.168.178.6:5232' \
--env='RADICALE_CONFIG=~/.config/radicale/config' \
--workers 2 radicale
"
else
echo "Verzeichnis nicht eingehängt. Versuche, es neu einzuhängen..."
# Check if the disk is mounted correctly this time, if not reboot
mount -a
echo "Mountpoit eingehongen, bitte erneut versuchen zu starten"
sleep 2
if mountpoint -q /raid; then
# Radicale starten
echo "starte radicale"
su - radicale -c "
cd /raid/home/radicale &&
source virtual/bin/activate &&
gunicorn -D --bind '192.168.178.6:5232' \
--env='RADICALE_CONFIG=~/.config/radicale/config' \
--workers 2 radicale
"
else
echo "Directory still not mounted. Now trying to restart Raspberry..."
reboot -h now
fi
fi
;;
stop)
# Terminate any hanging processes
pkill -P1 gunicorn
sleep 2
echo "radicale killed"
;;
status)
# Using netstat to find the PID of the process running on port 5232
pid=$(netstat -tlp 2>/dev/null | awk '/:5232/ {split($NF, a, "/"); print a[1]}')
if [ -n "$pid" ] && [ -e /proc/${pid} ]; then
echo "Radicale is running with PID $pid"
else
echo "Radicale is not running"
fi
;;
*)
echo "Usage: $N {start|stop|status}" >&2
exit 1
;;
esac
exit 0 Have fun |
Beta Was this translation helpful? Give feedback.
-
Hi!
Can you share a configuration for running Radicale as a SysVinit service?
I managed the installation in LXC with Alpine Linux and the application is running.
THX
Beta Was this translation helpful? Give feedback.
All reactions