Script to run (log) top command after every few minutes using crontab (CPU utilization logs)
top -b -n 1 | head -17 >> /var/log/logging.txt
echo “=========” >> /var/log/logging.txt
Change the permissions to execute:
chmod 777 script1
Put a shell script in one of these folders: /etc/cron.daily, /etc/cron.hourly, /etc/cron.monthly or /etc/cron.weekly
If these are not enough for you, you can add more specific tasks eg. twice a month or every 5 minutes or… go to the terminal and type:
this will open your personal crontab (cron configuration file), so use http://crontab-generator.org/ to generate the crontab line and paste it under the file.