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

Re: Exploring the possibilities of cron



On Tue, Aug 22, 2000 at 07:21:01PM -0500, Brent Harding wrote:
> How would cron do something such as, emailing 	a file once and awhile, make
> the file empty, and wait until the next run, but not mail anything if it's
> empty. I've never done much with emailing besides piping echo to mail, but
> it's limited to one line.

If you're looking for cron to do all of this, you're probably expecting
too much.  However, having cron launch a script hourly to test the file
condition and perform an action is eminantly doable.  This is
essentially what a scheduled mail daemon does.

> Supposing every hour I want it to email me all the users that my friend
> requested to be created with a requser script. The script, with echo and
> read commands would give the user info to a file, when echoed and appended,
> but when the cat filename | mail root won't tell me what the mail is for,
> just a bunch of users and passwords. Wonder if cron could be used to just
> create the users, so I don't need my friend to have root access. I don't
> trust him with it as he doesn't know a real lot about linux, but he may
> want email addresses custom to what he chooses, or recreating stuff.

For this purpose, you might want to look at 'sudo'.  The man pages
include examples of how to set up an account with privileges to create
new userIDs.  

This is essentially what you're giving your friend rights to do via your
cron script, though quite likely the cron job would entail greater
security risks unless you plan to check for specific conditions of file
ownership, read/write permissions, etc.  You've authorized your friend
to create user accounts but thrown in an arbitrary delay (the
periodicity of the cron job) into the process.  Better to use sudo,
monitor your friend's activities while limiting his rootly powers, and
be secure about it to boot.



...in an aside to Steve Lamb, this is an example of suggesting to a user
that they may not actually want to know how to do what it is that they
are asking for, but find out the proper tools for the job.

-- 
Karsten M. Self <kmself@ix.netcom.com>     http://www.netcom.com/~kmself
 Evangelist, Opensales, Inc.                    http://www.opensales.org
  What part of "Gestalt" don't you understand?   Debian GNU/Linux rocks!
   http://gestalt-system.sourceforge.net/    K5: http://www.kuro5hin.org
GPG fingerprint: F932 8B25 5FDD 2528 D595 DC61 3847 889F 55F2 B9B0

Attachment: pgp2TF4WeEpEP.pgp
Description: PGP signature


Reply to: