I have written a small bash script which clears the logs (say that script name is clearLogs.sh).
- My task: To run the bash script on an hourly basis to clear the logs
-
What I have done so far: I have created a symbolic link of my bash script and placed it in /etc/cron.hourly.
example -> cd /etc/cron.hourly ln -s /home/sam/clearLogs.sh clearLogs.sh
Now, an hour has passed but the logs have not been deleted. If I run a script standalone it works as expected. Can you guys please let me know what I am doing wrong here.
1.in clearLogs.sh add line: RUN_PATH=/you/script/path cd $RUN_PATH
2.cat “* */1 * * * /you/script/path/clearLogs.sh” >> $HOME/crontab.txt
3.crontab $HOME/crontab.txt
4.crontab -l,look all crontab job