I have set up a cron job in /etc/crontab.
The line looks like this:
Code:
02 * * * * root /bin/echo "update process_control set log_level='INFO' where name ='TransmitterController TH1'" | /usr/bin/mysql -uphp -pmypasswd event_reports_dev
What I see in /var/log/syslog is this:
Code:
/bin/echo "update process_control set log_level='INFO' where name ='TransmitterController TH1'" | /usr/bin/mysql -uphp -pmypasswd event_reports_dev
That is the command line exactly as I want it.
However, the requested setting is
not performed with mysql. When I enter the command on the command line, it is set, so my syntax should be correct.
I know that piping creates a different process, different subshell, but I don't see an apparent reason why I should not be allowed to do this in a cron job. I create a string, echo it, pipe it, another shell gets started, mysql is called and the string is piped from one shell to the other.
Anyway, I put the whole command line including pipe in a script file, and call the script file from cron. It works perfectly.
Somehow I don't seem to understand what it going on in cron.
jlinkels