Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2002 10:59:38 +0100
From:      Roman Neuhauser <neuhauser@bellavista.cz>
To:        Jeff Penn <jeff@jrpenn.demon.co.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Changing to/from user within script
Message-ID:  <20021125095938.GU77198@freepuppy.bellavista.cz>
In-Reply-To: <20021121221155.GA3926@jrpenn.demon.co.uk>
References:  <20021121221155.GA3926@jrpenn.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
# jeff@jrpenn.demon.co.uk / 2002-11-21 22:11:55 +0000:
> I want to run a cron job as a user on my system.  Once the job has
> completed I need root privileges to power the system down.  I don't 
> mind if the script has to run as a root cron job, but running the 
> processing as a user will prevent against filling a partition. 

    1)
        joe's crontab:

        # do the grunt work
        touch /var/run/shutdown

        root's crontab:

        [ -f /var/run/shutdown ] && \
            rm -f /var/run/shutdown && \
            /sbin/shutdown -h now
 
    2)
        joe's crontab:

        # do the grunt work
        /usr/local/bin/sudo /sbin/shutdown -h now

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021125095938.GU77198>