adaptation pour www.ykn.fr
This commit is contained in:
47
hubic-sur-debian/hubicSytemd
Normal file
47
hubic-sur-debian/hubicSytemd
Normal 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
|
13
hubic-sur-debian/hubicSytemd.service
Normal file
13
hubic-sur-debian/hubicSytemd.service
Normal 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
|
Reference in New Issue
Block a user