Shell and Apple script not working

I'm using a script to add ebooks (ePub and PDFs) automatically to Calibre, using
as an embedded shell script. This works fine. However, I wanted to add a condition to this rule that Calibre itself isn't running, as that will cause
I'm using the following embedded shell script as a rule condition:
This gives me a Rule does not match whether Calibre is running or not.
Using the following embedded Apple Script
gives me an "Error evaluation condition":
Any hints?
- Code: Select all
/Applications/calibre.app/Contents/MacOS/calibredb add "$1"
as an embedded shell script. This works fine. However, I wanted to add a condition to this rule that Calibre itself isn't running, as that will cause
- Code: Select all
calibredb
I'm using the following embedded shell script as a rule condition:
- Code: Select all
#!/bin/bash
PROCESS=calibre
number=$(ps aux | grep -v grep | grep -ci $PROCESS)
if [ $number -gt 0 ]
then
exit 1
else
exit 0
fi
This gives me a Rule does not match whether Calibre is running or not.
Using the following embedded Apple Script
- Code: Select all
if application "calibre" is running then
return false
else
return true
end if
gives me an "Error evaluation condition":
- Code: Select all
Error executing AppleScript: calibre got an error: Can’t get running.
Any hints?