[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cron not working



On Sun, Jul 12, 2015 at 06:33:40PM +0000, Dan Purgert wrote:
> Perhaps "environment variable" was the wrong phrase.  I've run into 
> issues with cron jobs if I don't have it calling #!/bin/bash at the top 
> (or #!/bin/[whatever]) ... running from a local terminal doesn't catch it 
> because "sh somescript.sh" invokes shell first...

My backup script begins with the line: #!/bin/sh. I'm changing it to
#!/bin/bash just in case.

> Although, if you're running this as "your user", then it might be failing 
> out as "mount" is only permitted to be run by root (might need to add it 
> to root's crontab).

No, when run manually I run it as root. I would get a partial backup
otherwise. The mount command works fine. I don't see why root's cron
would have any problem with it.

I'd like to put an alert right at the beginning of the script to tell me
at least that it is being accessed by cron. Perhaps this: 

   printf "cron sees script" >> /home/haines/cronAlert



Reply to: