I am trying to get cron job to delete a user.
I can do it easily from the CLI … but not from my cron script.
CLI: (Both these work)
/usr/share/openhab/runtime/bin/client -p habopen users remove myUser
/usr/bin/openhab-cli console -p habopen users remove myUser
Here is (an extract) from my cron script:
/etc/cron.hourly/myscript
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Set environment
. /etc/profile.d/openhab.sh
# Delete user
OUT=$(/usr/share/openhab/runtime/bin/client -p habopen users remove myUser)
echo $OUT >> /root/mylog.txt
If I run this script manually from the debian command prompt (logged in as root):
- Works perfectly
But when cron runs the script
- it fails, and /root/mylog.txt contains this:
Closed
Any advice on how to get openhab-cli console to work from a script file?
Rob