Вы могли создать маленькую станцию мониторинга... существуют различные продукты, которые можно установить через несколько минут (zenoss, zabbix, pandorafms, nagios, и т.д.). Я думаю, что самой важной вещью контролировать являются журналы. Для Linux Вы могли запустить с logwatch
Its important to remember that upstart is an event driven system, not a dependency based system.
So using "and" can be dangerous. You're asking upstart to wait until all of these events happen to start your job.
So, the first time net-device-up IFACE=eth0 is emitted (during boot if its a server, or whenever it gets plugged in if its a laptop and managed by NetworkManager), then that will be the first condition. Then upstart will wait until apache2 is stopped. Thats not going to ever be emitted if you are using the system apache2 script, because its in /etc/init.d, and won't emit starting/started/stopping/stopped events.
What you probably want is this:
start on stopping mysql
task
pre-start script
if service apache2 status ; then
exit 0
fi
exec /my/backup/script
end script
Note that the task is important above. It tells upstart that this job is not "done" until the main script exits. That way mysql's stopping event will block on this job until it is done. The check on apache2 may not be right.. since I'm not sure what you want to do if apache2 is still running when mysql is stopping. In fact, the two events are not coordinated and actually happen in parallel during system shutdown, so if you want them to be coordinated you probably need another upstart job which will stop/start apache2. This would suffice
start on started mysql
stop on stopping mysql
pre-start exec /etc/init.d/apache2 start
post-stop exec /etc/init.d/apache2 stop
You'd also need to remove the normal links with update-rc.d -f apache2 remove
. I'd suggest calling this something like apache2-upstart so that it doesn't confuse the service command.