How can I run the sar command to run daily using cron then get killed every 24 hours and start over again creating a new log file?
Command:
sar -u 300 288 >> $(date "+ %Y-%m-%d")-cpu.log This will log usage every 15 minutes for just over 24 hours.
Would this be a proper bash script?
#!/bin/bash # Kill current process kill sar # Start new sar sar -u 300 290 >> $(date "+ %Y-%m-%d")-cpu.log