[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
Finally, after run cron with debug flags and take a look at cron source code,
I found that the problem is that mysql daemon does not close output pipes and
the following script ,I run from cron, does not force pipes to be closed .
#!/bin/sh
/usr/local/etc/rc.d/mysql-server.sh stop
echo "Start at `date`"
/usr/local/etc/rc.d/mysql-server.sh start 2>&1 > /dev/null
echo "Stop at `date`"
I solve the problem by writing small C program to close pipes
and call /usr/local/etc/rc.d/mysql-server.sh
#include <stdio.h>
int main(int argc,char* argv[])
{
const char *cmd = "/usr/local/etc/rc.d/mysql-server.sh";
int i;
close(1);
close(2);
fopen("/dev/null","wt");
fopen("/dev/null","wt");
execl(cmd,cmd,"start",0);
perror("Can not execl");
return 1;
}
And change the script to
#!/bin/sh
/usr/local/etc/rc.d/mysql-server.sh stop
echo "Start at `date`"
/home/cws/testcron/start-mysqld
echo "Stop at `date
Now , every thing work as I expect.
Regards,
Chatchawan Wongsiriprasert
To Unsubscribe: send mail to majordomo@xxxxxxxxxxx
with "unsubscribe freebsd-stable" in the body of the message