Can enable services systemd excaped

pull/177/head
psfloyd 2017-12-08 00:23:17 -03:00
parent 94bda77b1b
commit d698d596d9
3 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,7 @@
Description=Google drive sync (changed files) Description=Google drive sync (changed files)
[Service] [Service]
ExecStart=@GRIVE_SYNC_SH_BINARY@ listen "%I" ExecStart=@GRIVE_SYNC_SH_BINARY@ listen "%i"
Type=simple Type=simple
Restart=always Restart=always
RestartSec=30 RestartSec=30

View File

@ -15,13 +15,13 @@ cd ~
### ARGUMENT PARSING ### ### ARGUMENT PARSING ###
SCRIPT="${0}" SCRIPT="${0}"
DIRECTORY=$(systemd-escape --unescape "$2")
if [[ -z "${2}" ]] || [[ ! -d "${2}" ]] ; then if [[ -z "$DIRECTORY" ]] || [[ ! -d "$DIRECTORY" ]] ; then
echo "Need a directory name in the current users home directory as second argument. Aborting." echo "Need a directory name in the current users home directory as second argument. Aborting."
exit 1 exit 1
fi fi
DIRECTORY="$2"
if [[ -z "${1}" ]] ; then if [[ -z "${1}" ]] ; then
echo "Need a command as first argument. Aborting." echo "Need a command as first argument. Aborting."
@ -102,6 +102,7 @@ listen_directory() {
do do
# Use a different call to not need to change exit into return # Use a different call to not need to change exit into return
inotifywait -q -r -e modify,attrib,close_write,move,create,delete --exclude ".grive_state|.grive" "${_directory}" > /dev/null 2>&1 && ${SCRIPT} sync "${_directory}" inotifywait -q -r -e modify,attrib,close_write,move,create,delete --exclude ".grive_state|.grive" "${_directory}" > /dev/null 2>&1 && ${SCRIPT} sync "${_directory}"
#echo ${SCRIPT} "${_directory}"
done done
# always exit ok, so that we never go into a wrong systemd state # always exit ok, so that we never go into a wrong systemd state

View File

@ -3,4 +3,4 @@ Description=Google drive sync
After=network-online.target After=network-online.target
[Service] [Service]
ExecStart=@GRIVE_SYNC_SH_BINARY@ sync "%I" ExecStart=@GRIVE_SYNC_SH_BINARY@ sync "%i"