Re: Create log file from script code..
- From: Vilmos Soti <vilmos@xxxxxxx>
- Date: 30 Mar 2006 13:47:50 -0800
Bit Twister <BitTwister@xxxxxxxxxxxxxxxx> writes:
On Thu, 30 Mar 2006 23:10:39 +0200, Geir Holmavatn wrote:
I have managed to create a few scripts which are started from crontab.
However I would like a verification that they actually have been executed.
How do I include in my bash script code to append a line like "MyScript was
run at <current date / time>" to the text file 'cronjobs.log' (and that
cronjobs.log is created if it doesn't exist)...
lots of code examples in /etc/init.d
echo "MyScript started $(date) " >> /tmp/cronjobs.log
This is the simplest solution, but be a bit careful. What happens
if two or more scripts want to update the file at the same time?
Maybe a good question, which the OP has to decide, if it is worth
to worry about. (most possibly not, but it is good to be aware of it.)
For extra points, read
! bash script introduction documentation
http://tldp.org/LDP/intro-linux/html/index.html
! bash script advanced documentation
http://tldp.org/LDP/abs/html/index.html
Agree.
Vilmos
.
- References:
- Create log file from script code..
- From: Geir Holmavatn
- Re: Create log file from script code..
- From: Bit Twister
- Create log file from script code..
- Prev by Date: rpm install from rescue CD
- Next by Date: Re: Create log file from script code..
- Previous by thread: Re: Create log file from script code..
- Next by thread: Re: Create log file from script code..
- Index(es):
Relevant Pages
|