2. Yes. I paste the following into my crontab as a reminder as to what the order of fields is:
#Crontab field order:
#minute (0-59),
#| hour (0-23),
#| | day of the month (1-31),
#| | | month of the year (1-12),
#| | | | day of the week (0-6 with 0=Sunday).
#| | | | | commands
You edit the crontab using crontab -e and make entries like the following - based on the above:
00 11 * * 0-6 "<script to run>"
This runs the script at 11:00 am every day. Save your crontab using wq!, as in vi.
3. I see no reason why db2 shouldn't be the same as any other database. We use Oracle and make entries of the type:
00 11 * * 0-6 su - oracle -c "<script to run>"
which runs the script under the Oracle user id. You can of course make a crontab for user Oracle or whoever if that's what you prefer. Bear in mind that cron uses a very restricted environment, so it may be necessary to explicitly set environment variables ($PATH etc) within the script itself - this is a common gotcha.
'l' is also safely distant from 'd' on my QWERTY keyboard, unlike 'e'. Who among us has never had their fingers on the incorrect home row?
I don't actually use 'crontab -e' at all. I make my backup, copy that backup to something like "crontab.new", edit it and then submit it with "crontab crontab.new". I know that -e is probably safe after I make the backup, but copying and editing confirms that the backup is good. Besides, I'm a belt and suspenders kind of guy when it comes to system modification.
Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.