Running mcetool as cronjob

Trying to let mcetool run some magic for a daylight alarm. The script only works if I run it from the terminal. But not if it is run as a cronjob. It runs commands like mcetool -U

First of all, I’d use a systemd timer instead of a crontab entry. And in those contexts you always have to assume minimal environments, i.e. no search paths. So you have to use a full path to the binary, not just its name.

Thanks! :+1: The full path was the solution.

I just remembered there were a bunch of systemd hints here:

Thanks for all the hints :slight_smile: Right now I try to figure out if I could let the script run 10min before a alarm is triggered (timedclient-qt5)
If someone is interested in the script:


# switch to sunrise ambience: yellow background/light theme
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/100000/dbus/user_bus_socket"
dbus-send --session --dest=com.jolla.ambienced --type=method_call /com/jolla/ambienced com.jolla.ambienced.setAmbience string:"file:///home/defaultuser/Sunrise/sunrise.ambience"

# turn on display and disable blank screen
/usr/sbin/mcetool -U
/usr/sbin/mcetool -j enabled

# increase brightness
for i in $(seq 1 1 100)
	/usr/sbin/mcetool -b $i
	sleep 3
sleep 300

# going back to normal brightness
for i in $(seq 100 -1 1)
	/usr/sbin/mcetool -b $i

# enable blank screen
/usr/sbin/mcetool -j disabled

# switch to standard ambience