Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Sep 2007 20:58:03 -0500
From:      Eric Crist <mnslinky@gmail.com>
To:        jackbarnett@gmail.com
Cc:        Freebsd questions <freebsd-questions@freebsd.org>
Subject:   Re: Running process on startup as a user
Message-ID:  <9A7065DE-29D6-4E6C-8451-9DF94D327F83@gmail.com>
In-Reply-To: <46E97E2D.7070300@gmail.com>
References:  <46E97E2D.7070300@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sep 13, 2007, at 1:15 PMSep 13, 2007, Jack Barnett wrote:

>
> Using FreeBSD 6.2 x86.
>
> I have a script called:
>
> /home/foo/scripts/MyScript.sh
> The user is 'foo'.  The password is 'bar'.
>
> What I'm trying to do is run the MyScript.sh command on startup  
> (that way if the box reboots, then this users process also re- 
> starts it's self).
>
> thoughts?
>

/etc/crontab allows you to actually specify the user to run the  
process as in the 6th field.  An entry such as:

@reboot     foo     /home/foo/scripts/MyScript.sh

Would work for running the process at startup.  The following entry  
is an example for running a script as user for every Monday on 3pm:

00     03    *     *     1     foo     /home/foo/scripts/MyScript.sh

And, as others have already said, you can just put the following  
entry in user foo's crontab:
* Note, you can access that user's crontab by loggin in as that user  
and typing "crontab -e", or as root by typing "crontab -e -u foo":

@reboot     /home/foo/scripts/MyScript.sh

HTH
-----
Eric F Crist
Secure Computing Networks





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9A7065DE-29D6-4E6C-8451-9DF94D327F83>