I have following bash script, I wanted to add few more things to it: (This script runs from root cronjob every 6 hours). Device is Raspberry Pi running raspberian.
#!/bin/bash
# Script: temp_email.sh
# -------------------------------------------------------
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"
echo "-------------------------------------------"
echo ""
echo ""
Following is the functionality I'd like to add to this:
I wanted to get current (at the time the script executes) status of apache2 web service. I have tried "service apache2 status"
but the output is too long. I would like to get a simple running / stopped in case of the service status.
I would like get status of 2 drives which are mounted under /mount_folder/ . I have tried mount -l
but again the information is too much. How do I get only the output for /dev/sd* devices?
Finally I would like for this script to start apache service if it is stopped and mount the devices under /dev/sd* to their respective mount point.
Could someone kindly guide me to it.