[Novalug] is this obvious (to everyone but me?)

Jon LaBadie novalugml@jgcomp.com
Sat Apr 4 12:48:22 EDT 2015


On Sat, Apr 04, 2015 at 11:29:30AM -0400, greg pryzby via Novalug wrote:
> i use
> crontab -e
> from the user I want to run the script.
> 
> putting a script in here will run, as root iirc
> 
> On Sat, Apr 4, 2015 at 11:24 AM, pereira via Novalug <
> novalug@firemountain.net> wrote:
> 
> > List,
> >
> > is doing a daily backup as simple as putting a backup script in
> > /etc/cron.daily?
> > Do all the executables in that directory get edited daily?
> >
> > Thank you for any hand-holding you may offer.
> >
> > Nino

The /etc/cron.* directories are typically used for system
activities.  As Greg noted, they are run as root.  Not a
bad idea for a backup system.  If you were to run your
backup script from /etc/cron.daily, I'd suggest putting
a call to your script there rather than the script itself.
That way you avoid the need to be root to update or edit
the script.

I'd recommend the alternate "crontab" Greg suggests.  With
user crontabs you get to specify a specific time to execute
rather than a "once a day, sometime" of /etc/cron.daily.

With user crontabs, your script will execute as you, not root.

With either cron scheme your environment will NOT be the same
as when you are logged in.  Things in your bash profile and
bashrc scripts will not have executed (unless you source them -
not recommended).  So check your script for such beasties.

Jon
-- 
Jon H. LaBadie                  novalugml@jgcomp.com
 11226 South Shore Rd		(703) 787-0688 (H)
 Reston, VA  20190		(703) 935-6720 (C)



More information about the Novalug mailing list