Scott Howard's picture

Hey all.

Just installed the lucid samba appliance as a bare metal install ( my virtual machine knowlede using virtualbox produced too slow a result...). Its working well.

I wrote a simple bash script to do a nightly back up and email me the output, after installing mutt and msmtp to the appliance (by the way msmtp appears by far the easiest MTA to install and configure for simple tasks like this).

tklbam-backup | mutt -s "Daily Backup Report"  <my email> is the key line in the script

The script is owned by  root and has rwx permissions.

Running the script as root from the command line worked perfectly, but when I set it to run as a cron job thru webmin, the backup always failed, and the emails the error "Fixclock hook failed", with  sh error saying ntpdate didnt exist ! (which it obviously does).

Looking at the fixclock script under the tklbam directory reveals the line which is failing. I changed the line in fixclock using the full path /usr/sbin/ntpdate  instead of just ntpdate and now all works well from cron.

I also set uid root on the script as well.

I dont really know how to explain the error though. Can someone enlighten me ?

 

Forum: 
Tags: 
Liraz Siri's picture

Thanks for reporting this. I consider this a bug. The problem is that cron has its own PATH, and /usr/sbin isn't in it. The fix is simple: add /usr/sbin to the PATH in the fixclock script. I'll push this out later today along with a bugfix for another issue.
Scott Howard's picture

Thanks Liraz for replying. You guys are doing a fantastic job.  I guess either / or is fine for the fixclock script.  In regards to cron though, wouldnt this bug have appeared for anybody who has turned on nightly backups during the install / configuration ?  Am I assuming incorrectly that this problem hasn't appeared before ???

And... while Ive got your attention.... (hopefully).....

Is anyone else having trouble deleting previous back ups from the turnkey hub site at amazon?

I have an old backup which I am trying to delete ... click the link etc, pop up comes up, click the delete button ... nothing happens. Tried several times, different browsers etc -- no result.

Did you guys write the code for all this or is this an amazon issue and should I talk to them ?

Its pretty cheap storage I know, but a penny saved is a penny earned (lol)......

 

Liraz Siri's picture

The problem with the cron PATH should have appeared before, so it is strange that nobody noticed reported it up until now. My best guess is that this only happens if you setup your own cron job and most people just activate /etc/cron.daily/tklbam-backup.

In general, if you come across an issue with the Hub, you report it to us via the feedback button on the side. If it's an issue with Amazon we will usually forward the issue to them, or figure out a workaround (or both).

This is the first time anyone has reported issues with backup deletion. Do me a favor, cut and paste your complaint into the feedback box in the Hub and send it to us via that. This way it's easier for me to find your Hub account and investigate further.

Scott Howard's picture

Ive just done this , but interestingly the pop up dialog seemed inactive after clicking <submit>. I had to close it manually, so it will be interesting to see whether you get my feedback. I suspect you may not because I actually did leave feedback regarding this after the first failure.

If you dont see it , is there any other way for you to see my account? I dont really want to post my email address on the forum.

Jeremy Davis's picture

Use the forum contact form, here is Liraz's. It send's an email using the email address your signed in with as the sender.

Liraz Siri's picture

We didn't get any feedback from you and I just tested the feedback dialog and it seems to work from FF and from Chrome. What browser are you using? I'm guessing the problems that are preventing you from submitting feedback is the same problem that is preventing you from deleting the backup.

Anyhow, I think I found your account and I see you have just one backup associated with your account.

Scott Howard's picture

Ive used all the above at different times. As below, I successfully deleted it from my XP laptop with IE8 last night... I really dont know what the difference was... see how it goes I guess.

Thanks again.

Christian's picture

is this already fixed in the apt repositories? If not - can you be more specific which script exactly has to be updated -- thanks!

Cheers,

C.

Jeremy Davis's picture

But I strongly suspect that Liraz will put the updated app in the apt repo. The way he said "push this out" makes me think that it may even be a 'security' update - thus automatically updated by the TKL default daily security updates. Only guessin though...

Liraz Siri's picture

It's just a minor bugfix with an easy workaround. Definitely not important or urgent enough to put into the security auto-updates repo. "Push out" is just a poorly defined euphemism.
Jeremy Davis's picture

I am inclined to agree (re making it a 'security' update - when it's obviously not). Although sounds like I was guilty of reading a full paragraph between the lines (so to speak) - that wasn't even there :). And I guess it depends on your context. By updating the version in the apt repo you are "pushing out" your bugfix version to the repo aren't you!?

Ahh the intricacies of the English language - I struggle sometimes and its the only language I know! No idea how crazy it must be for you guys for whom its a second or third language!

Scott Howard's picture

The script is 'fixclock' which appears to synchronise your machine with amazon before anything else occurs.

It is located in the /etc/tklbam/hooks.d/ .

I changed the command = "ntpdate -u + NTPSERVER"  to command = "/usr/sbin/ntpdate -u + NTPSERVER" to get my script to work, for the reasons set out above, but as Liraz wrote, he added /usr/sbin/ to the PATH to get the same result.

 

By the way , if youre seeing this Liraz, my backup deletion problem has now gone away... dont know if you did anything or if I've done something right this time....

Scott Howard's picture

And by the way I wouldnt be so presumptious to suggest that anything should be altered on anybodys' computer other than what the developers have written ! I just did this to get my script to work, and as stated, Liraz appears to be going to officailly fix the issue.

Liraz Siri's picture

I committed a fix to the hook but it won't apply to existing installations since the hook is in /etc. Technically that makes it a configuration file, which don't get updated through the package management.

That's a bit inconvenient, but not a big deal because on closer inspection it turns out this isn't exactly a bug, and it doesn't happen unless you configure your own cron jobs via webmin which is probably the reason nobody noticed it up until now. If you just activate the /etc/cron.daily/tklbam-backup script everything works fine, because cron.daily is from from /etc/crontab which does this:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

But this doesn't work if you setup a job via webmin because it doesn't go through /etc/crontab, so the PATH looks like this:

PATH=/usr/bin:/bin
So this isn't exactly a bug, but it is an annoying edge case so I committed a fix which changes the hook as follows:

diff --git a/contrib/fixclock-hook b/contrib/fixclock-hook
index 0085c03..6361c47 100755
--- a/contrib/fixclock-hook
+++ b/contrib/fixclock-hook
@@ -24,6 +24,8 @@ $ERROR
 """

 def fixclock():
+    os.environ['PATH'] += ':/usr/sbin'
+
     command = "ntpdate -u " + NTPSERVER

     try:

Add new comment