Right way to write service log file

To work around the command restrictions, you should create a wrapper script containing your full command and call that instead (make sure the script is executable or it won’t be runnable):

#!/bin/sh
$SNAP/bin/auto-cpufreq --daemon 2>&1 | tee -a $SNAP_DATA/auto-cpufreq.log

By default, tee will output anything you send it to STDOUT in addition to writing it to the file. This is why it is appearing in your syslogs. You can try replacing the tee command with >> $SNAP_DATA/auto-cpufreq.log or redirecting STDOUT to /dev/null.

2 Likes