From owner-freebsd-questions@FreeBSD.ORG Fri Sep 14 01:58:10 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDE3416A419 for ; Fri, 14 Sep 2007 01:58:10 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.228]) by mx1.freebsd.org (Postfix) with ESMTP id 839C413C442 for ; Fri, 14 Sep 2007 01:58:10 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: by nz-out-0506.google.com with SMTP id l8so494165nzf for ; Thu, 13 Sep 2007 18:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; bh=ZHs0NEYZ1dq7s1xxFDS7ma2dV49C75oJivw5YWMPRfo=; b=S4TDL1qdutl2YVpl9FYpGAf31HTcpQSmYOPEO5Fw+nd5dAKYQ7lLIPK1s9mKcHqelC7AjNfJc5rKYsQZWXc1uERY28QN517RL9dFJDR9MNrAV/klZPhPo2EwuUqgEcPqkSTp55cw4759n51NXhfadmT7aD4fmfkyXXHpOQoNCU0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=cpcAijcIfhCNRrJ3dLoT19wDj9vFV49rhbBirKOkIho//F/LbjviA1IvJ1w+wcTiX6t+4JsCsKGwR9b3B3yX2EQFb4+774VYm2fh+FUeZzge4AVbOUDL0usufqLHvYYV9PGYIDpgEdCGApPSxgQlzpvOjO9tQjbKNkuDyFCvM1g= Received: by 10.65.81.10 with SMTP id i10mr2946474qbl.1189735089566; Thu, 13 Sep 2007 18:58:09 -0700 (PDT) Received: from ?192.168.1.3? ( [209.240.66.157]) by mx.google.com with ESMTPS id 18sm901847nzo.2007.09.13.18.58.07 (version=SSLv3 cipher=OTHER); Thu, 13 Sep 2007 18:58:08 -0700 (PDT) In-Reply-To: <46E97E2D.7070300@gmail.com> References: <46E97E2D.7070300@gmail.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9A7065DE-29D6-4E6C-8451-9DF94D327F83@gmail.com> Content-Transfer-Encoding: 7bit From: Eric Crist Date: Thu, 13 Sep 2007 20:58:03 -0500 To: jackbarnett@gmail.com X-Mailer: Apple Mail (2.752.3) Cc: Freebsd questions Subject: Re: Running process on startup as a user X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2007 01:58:10 -0000 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