crontab
min (0-59) hour (0-23) day-of-month (1-31) day-of-week (0-6, Sunday=0) command
Run script every minute
* * * * /home/user1/monitoring.sh
monitoring.sh
touch monitoring.sh
chmod u+x monitoring.sh
#!/usr/bin/bash
SCRIPT_DIR=/tmp
ps -ef >> ${SCRIPT_DIR}/monitoring.log
cat ${SCRIPT_DIR}/monitoring.log | sort | uniq > ${SCRIPT_DIR}/monitoring.tmp
cat ${SCRIPT_DIR}/monitoring.tmp > ${SCRIPT_DIR}/monitoring.log