0

I have two bash scripts and I want them to run on startup. I'm using sway and I execute scripts with exec word like this

exec /home/crawraps/.config/sway/gdrive-push-sync.sh
exec /home/crawraps/.config/sway/gdrive-pull-sync.sh

The problem is that one of these scripts is working and the other is not. In particular gdrive-push-sync.sh is not working. Both of them are executable and both of them are working if I run them manually.

I've tested push script manually and also I can see pull script running in htop but no push script.

I'm using Arch-linux

gdrive-push-sync.sh:

#!/bin/bash

cd $GDRIVE
ignore=".gd/"

inotifywait $GDRIVE -m -r -e modify -e create -e delete -e move |
  while read directory action file; do
    relPath=${directory#"$GDRIVE"}
    if [ "$relPath" != "$ignore" ]; then
      echo "$action $relPath$file"
      drive push $relPath$file
    fi
  done

gdrive-pull-sync.sh:

#!/bin/bash

cd $GDRIVE

while true
do
drive pull
sleep 10m
done
1
  • Welcome to the site. It would seem that your scripts are relying on an environment variable $GDRIVE. Can you edit your post to explain when and where this variable is set and exported?
    – AdminBee
    Jun 24 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.