adaptation pour www.ykn.fr

This commit is contained in:
2020-05-13 12:51:58 +02:00
parent 62f9f7d1cf
commit fe8ec6d6fe
9 changed files with 4 additions and 37 deletions

View File

@@ -0,0 +1,47 @@
#!/bin/bash
if [[ ! -d ~/.config/hubiC/ ]]; then
echo "~/.config/hubiC/ does not exist, hubic is not configured?"
elif [[ $1 == "start" ]]; then
if [[ ! -e /tmp/hubic.dbus ]]; then
# Stocker une nouvelle session DBUS dans un fichier
dbus-daemon --session --fork --print-address > /tmp/hubic.dbus
# Charger la session DBUS
export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/hubic.dbus`
# Démarrer de HubiC
hubic start
else
echo "/tmp/hubic.dbus already exist"
fi
elif [[ $1 == "stop" ]]; then
if [[ -e /tmp/hubic.dbus ]]; then
# Charger la session DBUS
export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/hubic.dbus`
# Arrêt de hubiC
hubic stop
# Suppression de le fichier contenant la session DBUS
rm /tmp/hubic.dbus
else
echo "/tmp/hubic.dbus does not exist"
fi
elif [[ $1 == "keepalive" ]]; then
if [[ -e /tmp/hubic.dbus ]]; then
# Charger la session DBUS
export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/hubic.dbus`
# Forcer la synchronisation
hubic synchronize
else
echo "/tmp/hubic.dbus does not exist"
fi
else
echo "Script to simplify management of hubiC."
echo
echo "This script needs one of the following settings to work:"
echo -e "\t- start\t: start hubiC in background "
echo -e "\t- stop\t: stop hubiC"
fi

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Hubic Service
After=network.target
[Service]
Type=forking
User=root
ExecStart=/opt/hubicSytemd start
ExecStop=/opt/hubicSytemd stop
RestartSec=10
[Install]
WantedBy=multi-user.target