From: "Boyd Stephen Smith Jr." <bss03@volumehost.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Sync and glsa-check from cron
Date: Tue, 19 Jun 2007 18:34:13 -0500 [thread overview]
Message-ID: <200706191834.19587.bss03@volumehost.net> (raw)
In-Reply-To: <46785807.4000801@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2076 bytes --]
On Tuesday 19 June 2007 17:26:15 Joshua Doll wrote:
> Nick wrote:
> > I can set up the sudoers part all fine, but is there anything I
> > should watch out for / consider when running these maintenance tools
> > from a cron job?
Oh, and I forgot to mention it in my other direct reply: You'll probably need
to specify the full path to those commands. $PATH is generally different or
unset when tasks are run from cron.
> I think cron can run jobs as root.
Yes, /etc/cron.{hourly,daily,weekly,monthly} contains scripts to be run as
root. Also, some (most? all?) cron daemons allow root to have a crontab
separate from the system crontab. If you have root access you can even
fiddle with the system crontab, but that's not the "preferred" solution.
Many cron daemons also allow jobs to be run as a user by maintaining a crontab
for each user and "su"-ing to the correct user (and cleaning/setting the
environment) before running the task. If I'm reading the question correctly,
he will be adding these actions to his user's crontab and then sudo-ing to
run the script. sudo can be set up to allow users to run tasks as root
without a password. sudo also cleans the environment by default, but that
can be turned off or made less strict.
However, tasks run by cron (either as root or as another user) will have
different environment variables set. e.g. /etc/profile and $HOME/.profile
are not sourced in the shell (generally cron jobs aren't run in a shell at
all). They will also generally not have a tty associated with them. Again,
if I'm reading the OP correctly, (s)he was wondering if those changes will
affect those two commands. Some commands / scripts are quite sensitive to
the environment and may give different results (or not work at all) when run
from a cron job.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss03@volumehost.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.org/ \_/
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-06-19 23:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-19 22:18 [gentoo-user] Sync and glsa-check from cron Nick
2007-06-19 22:26 ` Joshua Doll
2007-06-19 23:34 ` Boyd Stephen Smith Jr. [this message]
2007-06-19 23:20 ` Boyd Stephen Smith Jr.
2007-06-20 7:50 ` Alan McKinnon
2007-06-20 14:04 ` Nick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200706191834.19587.bss03@volumehost.net \
--to=bss03@volumehost.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox