Hi,
This part can be shortened:
Code:
last_cron_time=$( cat /var/log/cron | grep "sh /root/c.sh" | cut -c 8- | tail -n 1 | cut -c -5)
I'm not sure if the output of your cron log is the same as mine, but this works on my side:
Code:
last_cron_time=$( awk '/sh \/root\/c.sh/ { print $3 }' /var/log/cron | tail -n 1)
(forward slashes do need to be escaped).
Hope this helps.