setting up cron job on Ubuntu

1. Create a file /home/james/tests/cronWriteDate.sh and put the below code

#/bin/sh
printf "timestamp:" >> /home/james/tests/testdate.log
date  >> /home/james/tests/testdate.log
printf "\n" >> /home/james/tests/testdate.log

2. For convenience, allow all permission for this script.

chmod 777 /home/james/tests/cronWriteDate.sh

3. Create a file /etc/cron.d/testdatecron and put the below line in it

* * * * * root /home/james/tests/cronWriteDate.sh

4. Done, every minute, cron will execute the script and write to the file /home/james/tests/testdate.log

Search within Codexpedia

Custom Search

Search the entire web

Custom Search