









|
[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
[NMLUG] Debian Startup Script
On Tue, Oct 05, 2004 at 07:40:13PM -0600, James Hamilton
carved this out of pure phosphors:
> There's several options, you can run it from cron as the user you could also
> use su to do that.
>
> su - jamesh -c /usr/local/bin/someprog
Don't forget sudo - it's got a nifty NOPASSWD: option that I used to make a PHP
script to edit iptables on the fly :)
apache ALL= NOPASSWD: /sbin/iptables
>
> Or you could make the binary setuid like:
>
> chown username program
> chmod 4700 program
>
> Now when root runs 'program' it should execute as 'username'.
>
> Setuid binaries should be used with caution (especially root suid's). Anyone
> that runs a suid binary runs it as the uid of the owner. So make sure you've
> got the write perms if you use one.
>
> On Tue, Oct 05, 2004 at 04:40:37PM -0700, Tim Emerick wrote:
> > Thanks for the script. Couple of questions.
> >
> > How would I get a particular daemon to run as a particular user?
> >
> > How do I get programs to run at boot with debian? With redhat I could just put the script in /etc/rc.local.
> >
> > Tim
> >
> > James Hamilton <jamesh@swcp.com> wrote:
> >
> > Here'a generic one that I use for such things. Just change the DAEMON, NAME,
> > DESC, and OPTIONS lines and it should fire right up.
> >
> > #! /bin/sh
> >
> > PATH=/sbin:/bin:/usr/sbin:/usr/bin
> > DAEMON=/some/path/to/program
> > NAME=PROGNAME
> > DESC="Description of your program here"
> >
> > OPTIONS=""
> >
> > test -x $DAEMON || exit 0
> >
> > set -e
> >
> > case "$1" in
> > start)
> > echo -n "Starting $DESC: "
> > start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS
> > echo "$NAME."
> > ;;
> > stop)
> > echo -n "Stopping $DESC: "
> > start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
> > echo "$NAME."
> > ;;
> > restart|force-reload)
> > echo -n "Restarting $DESC: "
> > start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
> > sleep 1
> > start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS
> > echo "$NAME."
> > ;;
> > *)
> > N=/etc/init.d/$NAME
> > echo "Usage: $N {start|stop|restart|force-reload}" >&2
> > exit 1
> > ;;
> > esac
> >
> > exit 0
> >
> >
> > On Mon, Oct 04, 2004 at 11:33:57AM -0700, Tim Emerick wrote:
> > > Hey all.
> > >
> > > I've been attempting to convert a startup script from Redhat to work on my Debian machine but being a bit of a noob it's greek to me. Can someone help me out. It's a script to startup BOINC as a daemon as the user boinc.
> > >
> > > The original Redhat script is here (http://noether.vassar.edu/~myers/help/boinc/init.d-boinc). I compared it to some standard debian scripts (atd, samba, etc) and I'm sure hacked it to pieces. The original script worked once I commented out the redhat functions line (line 20??). It was ugly and spewed error messages but it worked. Here's what I have so far in my conversion process......it doesn't work. ...sigh...
> > >
> > > Thanks - Tim
> > >
> >
> >
> > --
> >
> > James Hamilton
> > Southwest Cyberport
> > http://www.swcp.com
> > 505-232-7992
> > _______________________________________________
> > NMLUG mailing list
> > NMLUG@nmlug.org
> > http://www.nmlug.org/mailman/listinfo/nmlug
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > vote.yahoo.com - Register online to vote today!
> > _______________________________________________
> > NMLUG mailing list
> > NMLUG@nmlug.org
> > http://www.nmlug.org/mailman/listinfo/nmlug
>
>
> --
>
> James Hamilton
> Southwest Cyberport
> http://www.swcp.com
> 505-232-7992
> _______________________________________________
> NMLUG mailing list
> NMLUG@nmlug.org
> http://www.nmlug.org/mailman/listinfo/nmlug
--
panic("Oh boy, that early out of memory?");
2.2.16 /usr/src/linux/arch/mips/mm/init.c
|
|