mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-15 20:25:18 +02:00
21f4d8e858
* Add init.d service file & helper script to start service * Change how configDirName is set as XDG_CONFIG_HOME does not exist on systems where X11 is not present. When using init scripts and using XDG_CONFIG_HOME, ~ is not expanded thus existing config cannot be found. Using ~ in --confdir also does not work when running under init.d
81 lines
1.3 KiB
Bash
81 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# chkconfig: 2345 20 80
|
|
# description: Starts and stops OneDrive Free Client
|
|
#
|
|
|
|
# Source function library.
|
|
if [ -f /etc/init.d/functions ] ; then
|
|
. /etc/init.d/functions
|
|
elif [ -f /etc/rc.d/init.d/functions ] ; then
|
|
. /etc/rc.d/init.d/functions
|
|
else
|
|
exit 1
|
|
fi
|
|
|
|
# Source networking configuration.
|
|
. /etc/sysconfig/network
|
|
|
|
# Check that networking is up.
|
|
[ ${NETWORKING} = "no" ] && exit 1
|
|
|
|
APP_NAME="OneDrive Free Client"
|
|
STOP_TIMEOUT=${STOP_TIMEOUT-5}
|
|
RETVAL=0
|
|
|
|
start() {
|
|
echo -n $"Starting $APP_NAME: "
|
|
daemon --user root onedrive_service.sh
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/onedrive || \
|
|
RETVAL=1
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
echo -n $"Shutting down $APP_NAME: "
|
|
killproc onedrive
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/onedrive ${pidfile}
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
rhstatus() {
|
|
status onedrive
|
|
return $?
|
|
}
|
|
|
|
# Allow status as non-root.
|
|
if [ "$1" = status ]; then
|
|
rhstatus
|
|
exit $?
|
|
fi
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
restart
|
|
;;
|
|
reload)
|
|
reload
|
|
;;
|
|
status)
|
|
rhstatus
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
|
exit 2
|
|
esac
|
|
|
|
exit $? |