Error Logging

While searching for ways to see if my daily Back In Time backup script was running as a cron job, I came across a web posting that showed how to extend a command line in a script in order to produce a log file of the specific event. In particular, one needs to add a directive at the end of the command and include the name of a file to be used to store the logged information. The addition to the command line takes the form:

>> /home/log/myscript.log 2>&1

Here, we can see that the output from the command will be sent to the file /home/log/myscript.log. The final parameter “2>&1” indicates that any output from the standard error (2 = stderr) function should be directed to wherever the standard output (1 = stdout) function is being directed. In this case since output is being routed to /home/log/myscript.log, any error messages will also be sent to this file.

A modified version of this technique was included on the command line in the backup script located in cron.daily. The actual command used was:

nice -n 19 /usr/bin/backintime –backup-job >/home/toaster/z_anacron_bit.txt

As was previously the case, testing the modified script didn’t create a new Back In Time snapshot, but now the test produced the following entry in the log file:

Back In Time
Version: 0.9.26
Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime –license’ for details.

WARNING: Not configured

So, following receipt of the E-mail confirmation discussed previously (see: Message in a bottle?), and from the contents of the above-noted log file, we know two things: (1) the scripts in cron.daily are being run by anacron, and (2) the Back In Time program starts to run but then seems to fail because it is “Not configured”.

The questions now become what can Back In Time tell us when it runs correctly, e.g. as a regularly scheduled job when the computer is turned on, and why is it “not configured” properly when running under anacron?

What we need is some further log information…

References:

Where is the cron / crontab log?
http://askubuntu.com/questions/56683/where-is-the-cron-crontab-log

Developing a Linux command-line utility
http://www.ibm.com/developerworks/linux/library/l-clutil/

Advertisements
This entry was posted in anacron, Applications, Backup, Bash script, Commands, cron and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s