I'm trying to write a script that checks if mysql is running, and if not restart it...
i get a script to run perfectly if is called manually from terminal, but when i added to crontab it outputs is totally different...
the code is
service mysql status
when run from terminal it just outputs
mysql start/running, process 2570
but when it runs from crontab it outputs
/usr/bin/mysqladmin Ver 8.42 Distrib 5.5.41, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Server version 5.5.41-0ubuntu0.14.04.1-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/run/mysqld/mysqld.sock
Uptime: 14 min 9 sec
Threads: 1 Questions: 2220 Slow queries: 0 Opens: 684 Flush tables: 1 Open tables: 170 Queries per second avg: 2.614
it seems that the crontab version calls /usr/bin/mysqladmin instead of mysql
how can i change this?